Methods, apparatus, and systems for secure demand paging and other paging operations for processor devices

ABSTRACT

A secure demand paging system ( 1020 ) includes a processor ( 1030 ) operable for executing instructions, an internal memory ( 1034 ) for a first page in a first virtual machine context, an external memory ( 1024 ) for a second page in a second virtual machine context, and a security circuit ( 1038 ) coupled to the processor ( 1030 ) and to the internal memory ( 1034 ) for maintaining the first page secure in the internal memory ( 1034 ). The processor ( 1030 ) is operable to execute sets of instructions representing: a central controller ( 4210 ), an abort handler ( 4260 ) coupled to supply to the central controller ( 4210 ) at least one signal representing a page fault by an instruction in the processor ( 1030 ), a scavenger ( 4220 ) responsive to the central controller ( 4210 ) and operable to identify the first page as a page to free, a virtual machine context switcher ( 4230 ) responsive to the central controller ( 4210 ) to change from the first virtual machine context to the second virtual machine context; and a swapper manager ( 4240 ) operable to swap in the second page from the external memory ( 1024 ) with decryption and integrity check, to the internal memory ( 1034 ) in place of the first page.

CLAIM OF PRIORITY

This application entitled “Methods, Apparatus, and is a divisional ofapplication Ser. No. 13/345,484, filed Jan. 6, 2012, which is adivisional of and incorporates by reference application Ser. No.11/426,597, filed Jun. 27, 2006, now U.S. Pat. No. 8,108,641, Systemsfor Secure Demand Paging and Other Paging Operations for ProcessorDevices”.

CROSS-REFERENCE TO RELATED APPLICATIONS

This patent application is related to provisional applicationTI-38213PS, U.S. Ser. No. 60/561,130, filed Apr. 8, 2004, entitled“Methods, Apparatus, and Systems for Secure Demand Paging for ProcessorDevices” of Steven C. Goss and Narendar Shankar which is herebyincorporated herein by reference.

This patent application incorporates herein by reference the followingU.S. patent applications, U.S. Ser. No. 11/100,689 filed Apr. 7, 2005,now U.S. Pat. No. 8,239,673, entitled “Methods, Apparatus and Systemswith Loadable Kernel Architecture for Processors”; U.S. Ser. No.11/100,690 filed Apr. 7, 2005, now U.S. Pat. No. 7,940,932, entitled“Methods, Apparatus, and Systems for Securing SIM (Subscriber IdentityModule) Personalization and Other Data on a First Processor and SecureCommunication of the SIM Data to a Second Processor”; U.S. Ser. No.10/915,830 filed Aug. 10, 2004, now U.S. Pat. No. 8,112,618, entitled“Less Secure Processors, Integrated Circuits, Wireless CommunicationApparatus, Methods and Processes of Making”; and U.S. Ser. No.11/426,598, now abandoned, entitled “Page Processing Circuits, Devices,Methods and Systems for Secure Demand Paging and Other Operations”

STATEMENT REGARDING FEDERALLY SPONSORED RESEARCH OR DEVELOPMENT

Not applicable.

BACKGROUND OF THE INVENTION

This invention is in the field of electronic computing hardware andsoftware and communications, and is more specifically directed toimproved processes, circuits, devices, and systems for page processingand other information and communication processing purposes, andprocesses of making them. Without limitation, the background is furtherdescribed in connection with demand paging for communicationsprocessing.

Wireline and wireless communications, of many types, have gainedincreasing popularity in recent years. The personal computer with awireline modern such as DSL (digital subscriber line) modem or cablemodern communicates with other computers over networks. The mobilewireless (or “cellular”) telephone has become ubiquitous around theworld. Mobile telephony has recently begun to communicate video anddigital data, and voice over packet (VoP or VoIP), in addition tocellular voice. Wireless modems, for communicating computer data over awide area network, using mobile wireless telephone channels andtechniques are also available.

Wireless data communications ire wireless local area networks (WLAN),such as that operating according to the well-known IEEE 802.11 standard,has become popular in a wide range of installations, ranging from homenetworks to commercial establishments. Short-range wireless datacommunication according to the “Bluetooth” technology permits computerperipherals to communicate with a personal computer or workstationwithin the same room. Numerous other wireless technologies exist and areemerging.

Security techniques are used to improve the security of retail and otherbusiness coma commercial transactions in electronic commerce and toimprove the security of communications wherever personal and/orcommercial privacy is desirable. Security is important in both wirelineand wireless communications.

As computer and communications applications with security become largerand more complex, a need has arisen for technology to inexpensivelyhandle large amounts of software program code and the data in a securemanner such as in pages for those applications and not necessarilyrequire substantial amounts of additional expensive on-chip memory for aprocessor to handle those applications.

Processors of various types, including DSP (digital signal processing)chips, RISC (reduced instruction set computing) and/or other integratedcircuit devices are important to these systems and applications.Constraining or reducing the cost of manufacture and providing a varietyof circuit and system products with performance features for differentmarket segments are important goals in DSPs, integrated circuitsgenerally and system-on-a-chip (SOC) design.

Further alternative and advantageous solutions would, accordingly, bedesirable in the art.

SUMMARY OF THE INVENTION

Generally and in one form of the invention, a secure demand pagingsystem includes a processor operable for executing instructions, aninternal memory for a first page in a first virtual machine context, anexternal memory for a second page in a second virtual machine context,and a security circuit coupled to the processor and to the internalmemory for maintaining the first page secure in the internal memory. Theprocessor operable to execute sets of instructions representing: acentral controller, an abort handler coupled to supply to the centralcontroller at least one signal representing a page fault by aninstruction in the processor, a scavenger responsive to the centralcontroller and operable to identify the first page as a page to free, avirtual machine context switcher responsive to the central controller tochange from the first virtual machine context to the second virtualmachine context; and a swapper manager operable to swap in the secondpage from the external memory with decryption and integrity check, tothe internal memory in place of the first page.

Generally, another form of the invention involves a wirelesscommunications unit including a wireless antenna, a wireless transmitterand receiver coupled to the wireless antenna, a DRAM (dynamic randomaccess memory), and a microprocessor. The microprocessor has a secureinternal memory and is coupled to at least one of the transmitter andreceiver. The microprocessor is operable for multi-threading a securedemand paging process and a non-secure process, and operable toestablish page configuration data and to secure demand page between thesecure internal memory and the DRAM in response to a page fault in thesecure internal memory, and operable to apply confidentiality processingpage-specifically when the page configuration data signifiesconfidentiality for the page, and to apply integrity processingpage-specifically when the page configuration data signifies integrityprotection for the page. A user interface is coupled to themicroprocessor.

Generally, a further form of the invention involves a method of securedemand paging (SDP) for portable telecommunication device having aprocessor, a secure internal memory, and an external DRAM. The methodincludes configuring with configuration data indicating pages forconfidentiality protection, and pages for integrity protection;multi-threading an SDP process and a non-secure process; executing theSDP process to swap between the external DRAM and the secure internalmemory in response to page faults in the secure internal memory so thatconfidentiality processing is applied specifically to pages for whichthe configuration data indicates confidentiality protection, andintegrity verification is applied specifically to pages for which theconfiguration data indicates integrity protection; and applying aprocess for determining when page replacement in the secure internalmemory is necessary, and if so then applying a page replacement processfor determination of priority for page replacement, that downgrades datapages in priority relative to code pages, downgrades recently loaded oraccessed pages in priority relative to earlier loaded or accessed pages,and downgrades dirty pages in priority relative to clean pages inpriority for page replacement.

Generally, a yet further form of the invention involves a secure demandpaging (SDP) system including a dynamic random access memory (DRAM), amicroprocessor having a secure internal memory and coupled to the DRAM,and a non-volatile memory storing a representation of operationsaccessible by the microprocessor including a coded physicalrepresentation of operations to configure an SDP space in the DRAM, toorganize the SDP space into virtual machine contexts, to organize atleast one of the virtual machine contexts into block book keeping blocksand book keeping spaces in the block book keeping blocks, and to executea secure demand paging process between the secure internal memory andthe DRAM.

Generally, another additional form of the invention involves a demandpaging system including a dynamic random access memory (DRAM), amicroprocessor for executing a protected application having a secureinternal memory having a physical address space and coupled to the DRAM,and a non-volatile memory storing a coded physical representation ofoperations accessible by the microprocessor and including a codedphysical representation of operations to establish a data structurepertaining at least in part to both the secure internal memory and theDRAM, the data structure organizing the protected application in thesecure internal memory into virtual pages by a first index for a bookkeeping element in use, and a second index for a block book keepingblock in use, and operations to demand page between the secure internalmemory and the DRAM utilizing the data structure.

Generally, a still another form of the invention involves a securedemand paging (SDP) system comprising an external volatile memory, amicroprocessor having a secure internal memory having a physical addressspace and the microprocessor operable for executing at least oneprotected application in the secure internal memory, and a non-volatilememory storing a coded physical representation of operations accessibleby the microprocessor including a representation of operations forrun-time initializing SDP including loading a protected applicationpage-wise from the non-volatile memory into the secure internal memory,indexing each page and integrity-flagging pages for which integrityprocessing is directed, and confidentiality-flagging pages for whichconfidentiality processing is directed, hashing each integrity-flaggedpage of the protected application to provide a respective page hash, andencrypting each confidentiality-flagged page together with therespective page hash, providing a header for pages including the pagehash, hashing the header, storing the header hash into a hash-field of abook keeping element for the page, and storing each book keeping elementand encrypted page into the external volatile memory.

Generally, another further form of the invention involves a securedemand paging (SDP) system including an external volatile memory, anexternal non-volatile memory storing a coded physical representation ofoperations accessible by the microprocessor including a representationof operations for an operating system, a client application, an SDPprotected application and at least one additional protected application;and a microprocessor having a non-secure memory space and a securememory space having a physical page space and the microprocessoroperable to load the SDP protected application from the externalnonvolatile memory into a portion of the secure memory protected fromunauthorized alteration. The SDP protected application includes an SDPabort handler and a representation of operations to load the additionalprotected application page-wise from the external non-volatile memoryvia decryption, authentication, encryption and integrity protectiongoverned by a page-specific confidentiality flag and page-specificintegrity flag into the external volatile memory. The microprocessor isfurther operable to execute an access in non-secure space by the clientapplication directed to the additional protected application, to detectan access abort and to vector the access abort to the SDP abort handler,the SDP protected application including operations to find a pertinentpage of the additional protected application in the secure memory and ifthe page is absent then to load the pertinent page of the additionalprotected application into the secure memory from the external volatilememory by decryption and authentication governed by the confidentialityflag and the integrity flag, and to initiate re-queue of the access tothe pertinent page in the secure memory.

Generally, a yet further form of the invention involves an articleincluding a storage medium and a coded physical representationestablished in the storage medium to represent electronic processoroperations including operations for an operating system, a clientapplication, a secure demand paging (SDP) protected application and atleast one additional protected application, the SDP protectedapplication including an SDP abort handler and a representation ofoperations to memory-save the additional protected application page-wisevia decryption, authentication, encryption and integrity protectiongoverned by a page-specific confidentiality flag and page-specificintegrity flag; the client application including a representation of anaccess directed to a pertinent page of the additional protectedapplication, the operating system including a representation of anaccess abort detection and an operation to vector access abort to theSDP abort handler, the SDP protected application further including arepresentation of an operation to search for the pertinent page of theprotected application, a load of a pertinent page of the protectedapplication by decryption and authentication governed by theconfidentiality flag and the integrity flag, and re-queue of the accessto the pertinent page.

Generally, a further additional form of the invention involves a securedemand paging (SDP) system including an external volatile memory, amicroprocessor coupled to the external volatile memory, themicroprocessor having a secure internal memory having a physical addressspace, and the microprocessor operable for executing at least oneprotected application in the secure internal memory; and a non-volatilememory storing a coded physical representation of operations accessibleby the microprocessor including a representation of operations toestablish a code page, a data page, and a stack in the secure internalmemory and further to establish a secure demand paging configuration inthe secure internal memory, the configuration including a page mappingof physical addresses to virtual addresses for a virtual machinecontext, an index of the virtual machine context, and at least onepage-specific lock for a page in the virtual machine context.

Generally, a still further additional form of the invention involves asecure demand paging (SDP) system including an external volatile memory,a microprocessor having a secure internal memory having a physicaladdress space and the microprocessor operable for executing at least oneprotected application in the secure internal memory; and a non-volatilememory storing a coded physical representation of operations accessibleby the microprocessor including a representation of operations toestablish a table identifying pages by page type alternatives code anddata and a representation of operations to request by page type a newpage that is absent from the secure internal memory, to search physicalpages in the secure internal memory to identify a physical page to wipebased on page type of physical page and page type of the requested page,and to access the external volatile memory for a new page.

Generally, another further additional form of the invention involves asecure demand paging (SDP) system comprising an internal secure memoryfor pages in a first virtual machine context; an external memory forpages in the first virtual machine context and in a second virtualmachine context; a processor coupled to the internal secure memory andto the external memory; and a non-volatile memory storing a codedphysical representation of operations accessible by the microprocessorincluding a representation of operations to handle an asynchronousmessage for the second virtual machine context when pages for the firstvirtual machine context are in the internal secure memory, theoperations to handle including operations to freeze execution in thefirst virtual machine context, to wipe a particular page in internalsecure memory occupying a predetermined page slot for handling theasynchronous message, to prepare for handling the asynchronous message,and to receive the asynchronous message into the predetermined pageslot.

Generally, yet another further additional form of the invention involvesa secure demand paging system including a secure internal memory, anexternal non-volatile memory having encrypted and integrity-protectedcode pages, an external volatile memory for swap pages; and a processorcoupled to the secure internal memory and to the external non-volatilememory and operable to decrypt and verify the integrity of the codepages thereby to transfer code pages to the secure internal memorydirectly from the external non-volatile memory bypassing the externalvolatile memory in respect of the code pages, and to swap out and swapin the swap pages between secure internal memory and the externalvolatile memory bypassing the external non-volatile memory in respect ofthe swap pages for the external volatile memory.

Generally, still another further form of the invention involves a securedemand paging system including a processor, a cryptographic accelerator,a hash accelerator, and a secure memory coupled to the processor andcoupled to transfer the same secure memory data to the cryptographicaccelerator and the hash accelerator in parallel, the hashingaccelerator operable to deliver a hash result directly to the processor.

Generally, still another further form of the invention involves aprocess of manufacturing a secure demand paging (SDP) system includingproviding a non-volatile memory with a signed SDP certificate includinga configuration parameters for the SDP system, providing a processorresponsive to the non-volatile memory to configure and execute an SDPprotected application, and manufacturing a telecommunications endproduct combining a wireless modem with the non-volatile memory and theprocessor.

Generally, still another further form of the invention involves a securedemand paging device including a cryptographic circuit, a direct memoryaccess (DMA) circuit coupled to the cryptographic circuit, a securememory coupled by the DMA circuit to the cryptographic circuit; and aprocessor operable for page scavenging of the secure memorysubstantially in parallel time-wise with at least some operation on afirst page by the cryptographic circuit.

Generally, still another further form of the invention involves a securedemand paging (SDP) system comprising an external volatile memory, amicroprocessor coupled to the external volatile memory, themicroprocessor having a secure internal memory having a physical addressspace, and the microprocessor operable to execute at least one protectedapplication in the secure internal memory and to execute a clientapplication at intervals and also have at least one interval oflower-activity status, and a non-volatile memory storing a codedphysical representation of operations accessible by the microprocessorincluding a representation of an SDP protected application including apage scavenger, and an operation to schedule the page scavenger for theat least one interval of lower-activity status.

Other forms of the invention involving processes of manufacture,processes of operation, circuits, devices, articles of manufacture,wireless communications products, wireless handsets and systems aredisclosed and claimed.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a pictorial diagram of a communications system includingsystem blocks, for example a cellular base station, a WLAN AP (wirelesslocal area network access point), a WLAN gateway, a personal computer,and two cellular telephone handsets, any one, some or all of theforegoing improved according to the invention.

FIG. 2 is a block diagram of inventive integrated circuit chips for usein the blocks of the communications system of FIG. 1.

FIG. 3 is a block diagram of inventive hardware and process blocks forselectively operating one or more of the chips of FIG. 2 for the systemblocks of FIG. 1.

FIG. 4 is a partially-block, partially data structure diagramillustrating an inventive process and circuit for secure demand paging(SDP).

FIG. 5 is a block diagram further illustrating an inventive process andcircuit for secure demand paging performing a Swap In.

FIG. 6 is a block diagram further illustrating an inventive process andcircuit COUPE demand paging performing a Swap Out.

FIG. 7 is a block diagram further illustrating an inventive process andcircuit for secure demand paging with encryption and DMA (direct memoryaccess).

FIG. 8 is a block diagram further illustrating an inventive process andcircuit for secure demand paging with a hash and DMA.

FIGS. 9A, 9B, 9C, 9D, 9E are partially-block, partially virtual addressspace, and partially-process diagrams showing an inventive sequence ofoperations wherein a client application in non-secure execution spacesuccessfully calls a secure application (Protected Application PA)involving inventive Secure Demand Paging.

FIG. 10 is a diagram of virtual address space showing shared and privatespaces including virtual memory contexts (VMCs) for use in embodimentsof inventive structures and processes.

FIG. 11 is a diagram of successively exploded views depicting physicaladdress space in internal Secure RAM for use in embodiments of inventivestructures and processes including inventive Secure Demand Paging.

FIG. 12 is a diagram of successively exploded views depicting physicaladdress space in external non-secure DRAM for use in embodiments ofinventive structures and processes including inventive Secure DemandPaging.

FIG. 13 is another diagram of successively exploded views depictingphysical address space in external non-secure DRAM for use inembodiments of inventive structures and processes including inventiveSecure Demand Paging.

FIG. 14 is a data structure diagram of a Descriptor Block for use ineither a Formatted Code page of FIG. 15 or a Formatted Data page of FIG.16 for use in embodiments of inventive structures and processesincluding inventive Secure Demand Paging.

FIG. 15 is a data structure diagram of a Formatted Code page for use inembodiments of inventive structures and processes including inventiveSecure Demand Paging.

FIG. 16 is a data structure diagram of a Formatted Data page for use inembodiments of inventive structures and processes including inventiveSecure Demand Paging.

FIG. 17 is an inventive process block diagram for Secure Demand Paging,including a Strategic Resolver for calling other process blocks.

FIG. 18 is an inventive process block diagram for Secure Demand Paging,detailing portions of FIG. 17 wherein the Strategic Resolver calls aScavenger and a Swapper Manager.

FIG. 19 is an inventive process block diagram for Secure Demand Paging,detailing portions of FIG. 18 involving calls to a Swapper Manager andan SDP External Storage Manager of FIG. 17 for Swap Out and Swap In.

FIG. 20 is an inventive process block diagram for Secure Demand Paging,detailing portions of FIG. 19 involving Swap In operations of SDPExternal Storage Manager.

FIG. 21 is an inventive process block diagram for Secure Demand Paging,detailing portions of FIG. 19 involving Swap Out operations of SDPExternal Storage Manager.

FIG. 22 is an inventive process block diagram for Secure Demand Paging,detailing secure bootstrapping including SDP Boot Initialization.

FIG. 23 is an inventive process block diagram for Secure Demand Paging,detailing a process of SDP Boot Initialization in FIG. 22, pertaining toconverting an SDP Certificate from Flash memory to a configurationSDP_CFG in Secure RAM of FIG. 11.

FIG. 24 is an inventive process block diagram for Secure Demand Paging,detailing a process of SDP Runtime Initialization, pertaining amongother things to organizing and loading software from Flash or downloadHost into the FIG. 12 data structure DRAM_PG_TRACK_ARRAY includingVirtual Machine Contexts (WACO in external DRAM as well as initializingportions of Secure RAM of FIG. 11.

FIG. 25 is an inventive process block diagram for Secure Demand Paging,further detailing inventive portions of the Strategic Resolver of FIG.17 wherein the Strategic Resolver performs an SDP initializationsequence for a new VMC or to switch to a new VMC, responds to AbortHandler process blocks and makes calls to various process blocks.

FIG. 26 is an inventive process block diagram for Secure Demand Paging,detailing an inventive process of a VMC Switch Manager block of FIG. 17.

FIG. 27 is an inventive process block diagram for Secure Demand Paging,detailing an inventive process of Secure Interrupt Handling forasynchronous messaging for use in connection with the processes of FIG.25 and FIG. 17.

FIG. 28 is a partially-process, partially-block, partially virtualaddress space diagram of Secure Demand Paging, detailing inventivealternative allocation strategy, control information, and processes forread faults on code and data, Write faults, and swapping.

FIG. 29 is a block diagram of inventive structure and process for DMA(Direct Memory Access) for concurrent control of cryptographic andhashing operations.

FIG. 30 is a flow diagram of a manufacturing process for makingtelecommunications unit having SDP.

DETAILED DESCRIPTION OF EMBODIMENTS

In FIG. 1, an improved communications system 1000 has system blocks asdescribed next. Any or all of the system blocks, such as cellular mobiletelephone and data handsets 1010 and 1010′, a cellular (telephony anddata) base station 1050, a WLAN AP (wireless local area network accesspoint, IEEE 802.11 or otherwise) 1060, a Voice WLAN gateway 1080 withuser voice over packet telephone (not shown), and a voice enabledpersonal computer (PC) 1070 with another user voice over packettelephone (not shown), communicate with each other in communicationssystem 1000. Each of the system blocks 1010, 1010′, 1050, 1060, 1070,1080 are provided with one or more PHY physical layer blocks andinterfaces as selected by the skilled worker in various products, forwireless, and/or for DSL (digital subscriber line broadband over twistedpair copper infrastructure), cable (DOCSIS and other forms of coaxialcable broadband communications), premises power wiring, fiber (fiberoptic cable to premises), and Ethernet wideband network. Cellular basestation 1050 two-way communicates with the handsets 1010, 1010′, withthe Internet, with cellular communications networks and with PSTN(public switched telephone network). Improved television apparatusincludes a set top box 1092 and television display 1094 provided asseparate products or integrated together into the same unit and furtherarranged as described herein.

In this way, advanced networking capability for services, software, andcontent, such as cellular telephony and data, audio, music, voice,video, e-mail, gaming, security, e-commerce, file transfer and otherdata services, internet, world wide web browsing, TCP/IP (transmissioncontrol protocol/Internet protocol), improved television, voice overpacket and voice over Internet protocol (VoP/VoIP), and other servicesaccommodates and provides security for secure utilization andentertainment appropriate to the just-listed and other particularapplications.

The embodiments, applications and system blocks disclosed herein aresuitably implemented in fixed, portable, mobile, automotive, seaborne,and airborne, communications, control, set top box, and other apparatus.The personal computer (PC) 1070 is suitably implemented in any formfactor such as desktop, laptop, palmtop, organizer, mobile phonehandset, PDA personal digital assistant and/or personal entertainmentunit (PEU) 1096, interact appliance, wearable computer, personal areanetwork, or other type. Internet sources, such as web sites 1055 and1065, are accessible by wireline and/or wireless apparatus as describedherein. Downloadable content and software are provided from and by anyof the devices in the system 1000. Optical disk 1075 is also an exampleof an article for providing coded physical representations of datastructures and processes for executing on apparatus herein.

For example, handset 1010 is improved and remains interoperable and ableto communicate with all other similarly improved and unimproved systemblocks of communications system 1000. On a cell phone printed circuitboard (PCB) 1020 in handset 1010, FIGS. 1 and 2 show a processorintegrated circuit and a serial interface such as a USB interfaceconnected by a USB line to the personal computer 1070. Reception ofsoftware, intercommunication and updating of information are providedbetween the personal computer 1070 (or other originating sourcesexternal to the handset 1010) and the handset 1010. Suchintercommunication and updating also occur automatically and/or onrequest via WLAN, Bluetooth, or other wireless circuitry.

For example, handset 1010 is improved for selectively determinablesecurity and economy when manufactured. Handset 1010 remainsinteroperable and able to communicate with all other similarly improvedand unimproved system blocks of communications system 1000. On a cellphone printed circuit board (PCB) 1020 in handset 1010 coupled to awireless antenna 1015, there is provided a higher-security processorintegrated circuit 1022, an SDRAM 1024 and an external flash memory1025, and a serial interface 1026. Serial interface 1026 is suitably awireline interface, such as a USB interface connected by a USB line tothe personal computer 1070 when the user desires and for reception ofsoftware intercommunication and updating of information between thepersonal computer 1070 (or other originating sources external to thehandset 1010) and the handset 1010. Such intercommunication and updatingalso occur via a processor such as for cellular modem, WLAN, Bluetooth,or other wireless or wireline modem processor and physical layer (PHY)circuitry 1028.

Processor integrated circuit 1022 includes at least one processor (orcentral processing unit CPU) block 1030 coupled to an internal (on-chipread-only memory) ROM 1032, an internal (on-chip random access memory)RAM 1034, and an internal (on-chip) flash memory 1036. In someembodiments, memory 1036 provides writeable non-volatile memory such asflash memory, ferroelectric memory, or EEPROM (electrically erasableprogrammable read only memory) or other suitable form. A security logiccircuit 1038 is coupled to secure-or-general-purpose-identificationvalue (Security/GPI) bits 1037 of a non-volatile one-time alterableProduction ID register or array of electronic fuses (E-Fuses). Dependingon the Security/GPI bits, boot code residing in ROM 1032 respondsdifferently to a Power-On Reset (POR) circuit 1042 and to a securewatchdog circuit 1044 coupled to processor 1030. A device-uniquesecurity key is suitably also provided in the E-fuses or downloaded toother non-volatile, difficult-to-alter parts of the cell phone unit1010.

It will be noted that the words “internal” and “external” as applied toa circuit or chip respectively refer to being on-chip or off-chip of theapplications processor chip 1022. All items are assumed to be internalto an apparatus (such as a handset, base station, access point, gateway,PC, or other apparatus) except where the words “external to” are usedwith the name of the apparatus, such as “external to the handset.”

ROM 1032 provides a boot storage having boot code that is executable inat least one type of boot sequence. One or more of RAM 1034, internalflash 1036, and external flash memory 1025 are also suitably used tosupplement ROM 1032 for boot storage purposes.

Secure Demand Paging SDP circuitry 1040 effectively multiplies thememory space that secure applications can occupy. Processor 1030 is anexample of circuitry coupled to the Secure Demand Paging block 1040 toexecute a process defined by securely stored code and data from a SecureRAM 1034 as if the secure RAM were much larger by using SDRAM 1024. Asdescribed further herein SDP Circuitry 1040 includes real-estatecircuitry for determining which secure RAM memory page to wipe, or makeavailable for a new page of code and/or data for a secure application.

FIG. 2 illustrates inventive integrated circuit chips including chips1100, 1200, 1300, 1400, 1500 for use in the blocks of the communicationssystem 1000 of FIG. 1. The skilled worker uses and adapts the integratedcircuits to the particular parts of the communications system 1000 asappropriate to the function's intended. For conciseness of description,the integrated circuits are described with particular reference to useof all of them in the cellular telephone handsets 1010 and 1010′ by wayof example.

It is contemplated that the skilled worker uses each of the integratedcircuits shown in FIG. 2, or such selection from the complement ofblocks therein provided into appropriate other integrated circuit chips,or provided into one single integrated circuit chip, in a manneroptimally combined or partitioned between the chips, to the extentneeded by any of the applications supported by the cellular telephonebase station 1050, personal computer(s) 1070 equipped with WLAN, WLANaccess point 1060 and Voice WLAN gateway 1080, as well as cellulartelephones 1010, 1010′, radios and televisions 1092, 1094, Internetaudio/video content players, fixed and portable entertainment units1096, routers, pagers, personal digital assistants (PDA), organizers,scanners, faxes, copiers, household appliances, office appliances,combinations thereof, and other application products now known orhereafter devised in which there is desired increased, partitioned orselectively determinable advantages next described.

In FIG. 2, an integrated circuit 1100 includes a digital baseband (DBB)block 1110 that has a RISC processor (such as MIPS core, ARM processor,or other suitable processor) and a digital signal processor such as fromthe TMS320C55x™ DSP generation from Texas Instruments Incorporated orother digital signal processor (or DSP core) 1110, communicationssoftware and security software for any such processor or core, securityaccelerators 1140, and a memory controller. Security accelerators block1140 provide additional computing power such as for hashing andencryption that are accessible, for instance, when the integratedcircuit 1100 is operated in a security level enabling the securityaccelerators block 1140 and affording types of access to the securityaccelerators depending on the security level and/or security mode. Thememory controller interfaces the RISC core 1105 and the DSP core 1110 toFlash memory 1025 and SDRAM 1024 (synchronous dynamic random accessmemory). On chip RAM 1120 and on-chip ROM 1130 also are accessible tothe processors 1110 for providing sequences of software instructions anddata thereto. A security logic circuit 1038 of FIGS. 1 and 2 has asecure state machine (SSM) to provide hardware monitoring of anytampering with security features. Secure Demand Paging (SDP) circuit1040 of FIGS. 1 and 2 is provided and described further herein.

Digital circuitry 1150 on integrated circuit 1100 supports and provideswireless interfaces for any one or more of GSM, GPRS, EDGE, UMTS, andOFDMA/MIMO (Global System for Mobile communications, General PacketRadio Service, Enhanced Data Rates for Global Evolution, UniversalMobile Telecommunications System, Orthogonal Frequency Division MultipleAccess and Multiple Input Multiple Output Antennas) wireless, with orwithout high speed digital data service, via an analog baseband chip1200 and GSM/CDMA transmit/receive chip 1300. Digital circuitry 1150includes ciphering processor CRYPT for GSM ciphering and/or otherencryption/decryption purposes. Blocks TPU (Time Processing Unitreal-time sequencer), TSP (Time Serial Port), GEA (GPRS EncryptionAlgorithm block for ciphering at LLC logical link layer), RIF (RadioInterface), and SPI (Serial Port Interface) are included in digitalcircuitry 1150.

Digital circuitry 1160 provides codec for CDMA (Code Division MultipleAccess), CDMA2000, and/or WCDMA (wideband CDMA or UMTS) wirelesssuitably with HSDPA/HSUPA (High Speed Downlink Packet Access, High SpeedUplink Packet Access) (or 1xEV-DV, 1xEV-DO or 3xEV-DV) data feature viathe analog baseband chip 1200 and RF GSM/CDMA chip 1300. Digitalcircuitry 1160 includes blocks MRC (maximal ratio combiner for multipathsymbol combining), ENC (encryption/decryption), RX (downlink receivechannel decoding, de-interleaving, viterbi decoding and turbo decoding)and TX (uplink transmit convolutional encoding, turbo encoding,interleaving and channelizing.). Block ENC has blocks for uplink anddownlink supporting confidentiality processes of WCDMA.

Audio/voice block 1170 supports audio and voice functions andinterfacing. Speech/voice codec(s) are suitably provided in memory spacein audio/voice block 1170 for processing by processor(s) 1110. Anapplications interface block 1180 couples the digital baseband chip 1100to an applications processor 1400. Also, a serial interface in block1180 interfaces from parallel digital busses on chip 1100 to USB(Universal Serial Bus) of PC (personal computer) 1070. The serialinterface includes UARTs (universal asynchronous receiver/transmittercircuit) for performing the conversion of data between parallel andserial lines. Chip 1100 is coupled to location-determining circuitry1190 for GPS (Global Positioning System). Chip 1100 is also coupled to aUSIM (UMTS Subscriber Identity Module) 1195 or other SIM for userinsertion of an identifying plastic card, or other storage element, orfor sensing biometric information to identify the user and activatefeatures.

In FIG. 2, a mixed-signal integrated circuit 1200 includes an analogbaseband (ABB) block 1210 for GSM/GPRS/EDGE/UMTS/HSDPA/HSUPA whichincludes SPI (Serial Port Interface),digital-to-analog/analog-to-digital conversion DAC/ADC block, and RF(radio frequency) Control pertaining to GSM/GPRS/EDGE/UMTS/HSDPA/HSUPAand coupled to RF (GSM etc.) chip 1300. Block 1210 suitably provides ananalogous ABB for CDMA wireless and any associated 1xEV-DV, 1xEV-DO or3xEV-DV data and/or voice with its respective SPI (Serial PortInterface), digital-to-analog conversion DAC/ADC block, and RF Controlpertaining to CDMA and coupled to RF (CDMA) chip 1300.

An audio block 1220 has audio I/O (input/output) circuits to a speaker1222, a microphone 1224, and headphones (not shown). Audio block 1220has an analog-to-digital converter (ADC) coupled to the voice codec anda stereo DAC (digital to analog converter) for a signal path to thebaseband block 1210 including audio/voice block 1170, and with suitableencryption/decryption activated.

A control interface 1230 has a primary host interface (I/F) and asecondary host interface to DBB-related integrated circuit 1100 of FIG.2 for the respective GSM and CDMA paths. The integrated circuit 1200 isalso interfaced to an I2C port of applications processor chip 1400 ofFIG. 2. Control interface 1230 is also coupled via access arbitrationcircuitry to the interfaces in circuits 1250 and the baseband 1210.

A power conversion block 1240 includes buck voltage conversion circuitryfor DC-to-DC conversion, and low-dropout (LDO) voltage regulators forpower management/sleep mode of respective parts of the chip regulated bythe LDOs. Power conversion block 1240 provides information to and isresponsive to a power control state machine between the power conversionblock 1240 and circuits 1250.

Circuits 1250 provide oscillator circuitry for clocking chip 1200. Theoscillators have frequencies determined by one or more crystals.Circuits 1250 include a RTC real time clock (time/date functions),general purpose I/O, a vibrator drive (supplement to cell phone ringingfeatures), and a USB On-The-Go (OTG) transceiver. A touch screeninterface 1260 is coupled to a touch screen XY 1266 off-chip.

Batteries such as a lithium-ion battery 1280 and backup battery providepower to the system and battery data to circuit 1250 on suitablyprovided separate lines from the battery pack. When needed, the battery1280 also receives charging current from a Battery Charge Controller inanalog circuit 1250 which includes MADC (Monitoring ADC and analog inputmultiplexer such as for on-chip charging voltage and current, andbattery voltage lines, and off-chip battery voltage, current,temperature) under control of the power control state machine.

In FIG. 2 an RF integrated circuit 1300 includes aGSM/GPRS/EDGE/UMTS/CDMA RF transmitter block 1310 supported byoscillator circuitry with off-chip crystal (not shown). Transmitterblock 1310 is fed by baseband block 1210 of chip 1200. Transmitter block1310 drives a dual band RF power amplifier (PA) 1330. On-chip voltageregulators maintain appropriate voltage under conditions of varyingpower usage. Off-chip switchplexer 1350 couples wireless antenna 1015and switch circuitry to both the transmit portion 1310, 1330 and thereceive portion 1360, 1370 next described. Switchplexer 1350 is coupledvia band-pass filters 1360 to receiving LNAs (low noise amplifiers) for850/900 MHz, 1800 MHz, 1900 MHz and other frequency bands asappropriate. Depending on the band in use, the output of LNAs couples toGSM/GPRS/EDGE/UMTS/CDMA receiver (RX) demodulator 1370 to produce theI/Q or other outputs thereof (in-phase, quadrature) to theGSM/GPRS/EDGE/UMTS/CDMA baseband block 1210.

Further in FIG. 2, an integrated circuit chip or core 1400 is providedfor applications processing and more off-chip peripherals. Chip (orcore) 1400 has interface circuit 1410 including a high-speed WLAN802.11a/b/g interface coupled to a WLAN chip 1500. Further provided onchip 1400 is an applications processing section 1420 which includes aRISC processor (such as MIPS core, ARM processor, or other suitableprocessor), a digital signal processor (DSP) such as from theTMS320C55x™ DSP generation from Texas Instruments Incorporated or otherdigital signal processor, and a shared memory controller MEM CTRL withDMA (direct memory access), and a 2D (two-dimensional display) graphicaccelerator. Speech/voice codec functionality is suitably processed inchip 1400, in chip 1100, or both chips 1400 and 1100.

The RISC processor and the DSP in section 1420 have access via arton-chip extended memory interface (EMIF/CF) to off-chip memory resources1435 including as appropriate, mobile DDR (double data rate) DRAM, andflash memory of any of NAND Flash, NOR Flash, and Compact Flash. On chip1400, the shared memory controller in circuitry 1420 interfaces the RISCprocessor and the DSP via an on-chip bus to on-chip memory 1440 with RAMand ROM. A 2D graphic accelerator is coupled to frame buffer internalSRAM (static random access memory) in block 1440. A security block 1450in security logic 1038 of FIG. 1 includes secure hardware acceleratorshaving security features and provided for secure demand paging 1040 asfurther described herein and for accelerating encryption and decryption.A random number generator RNG is provided in security block 1450. Amongthe Hash approaches are SHA-1 (Secured Hashing Algorithm), MD2 and MD5(Message Digest version #). PKCS (Public Key Cryptography Standard) PSS(Probabilistic Signature Scheme) signature format supports signing.Among the symmetric approaches are DES (Digital Encryption Standard),3DES (Triple DES), CBC (Cipher-Block Chaining), RC4 (Rivest Cipher),ARCO (related to RC4), TKIP (Temporal Key Integrity Protocol, uses RC4),AES (Advanced Encryption Standard). Among the asymmetric approaches areRSA, DSA, DH, NTRU, and ECC (elliptic curve cryptography). The securityfeatures contemplated include any of the foregoing hardware andprocesses and/or any other known or yet to be devised security and/orhardware and encryption/decryption processes implemented in hardware orsoftware.

Security logic 1038 of FIG. 1 and FIG. 2 (1038, 1450) includeshardware-based protection circuitry, also called security monitoringlogic or a secure state machine 2060 of FIG. 3. Security logic 1038 iscoupled to and monitors busses and other parts of the chip for securityviolations and protects and isolates the protected areas. Security logic1038 makes secure ROM space inaccessible, makes secure RAM and registerspace inaccessible and establishes any other appropriate protections toadditionally foster security. In one embodiment such a software jumpfrom Flash memory to secure ROM, for instance, causes a securityviolation wherein, for example, the security logic 1038 produces anautomatic immediate reset of the chip. In another embodiment, such ajump causes the security monitoring logic to produce an error messageand a re-vectoring of the jump away from secure ROM. Other securityviolations would include attempted access to secure register or RAMspace.

On-chip peripherals and additional interfaces 1410 include DART datainterface and MCSI (Multi-Channel Serial Interface) voice wirelessinterface for an off chip IEEE 802.15 (“Bluetooth” and high and low ratepiconet and personal network communications) wireless circuit 1430.Debug messaging and serial interfacing are also available through theUART. A JTAG emulation interface couples to an off-chip emulatorDebugger for test and debug. Further in peripherals 1410 are an I2Cinterface to analog baseband ABB chip 1200, and an interface toapplications interface 1180 of integrated circuit chip 1100 havingdigital baseband DBB.

Interface 1410 includes a MCSI voice interface, a UART interface forcontrols, and a multi-channel buffered serial port (McBSP) for data.Timers, interrupt controller, and RTC (real time clock) circuitry areprovided in chip 1400. Further in peripherals 1410 are a MicroWire(u-wire 4 channel serial port) and multi-channel buffered serial port(McBSP) to Audio codec, a touch-screen controller, and audio amplifier1480 to stereo speakers. External audio content and touch screen(in/out) and LCD (liquid crystal display) are suitably provided.Additionally, an on-chip USB OTG interface couples to off-chip Host andClient devices. These USB communications are suitably directed outsidehandset 1010 such as to PC 1070 (personal computer) and/or from PC 1070to update the handset 1010.

An on-chip UART/IrDA (infrared data) interface in interfaces 1410couples to off-chip OPS (global positioning system block cooperatingwith or instead of GPS 1190) and Fast IrDA infrared wirelesscommunications device. An interface provides EMT9 and Camera interfacingto one or more off-chip still cameras or video cameras 1490, and/or to aCMOS sensor of radiant energy. Such cameras and other apparatus all haveadditional processing performed with greater speed and efficiency in thecameras and apparatus and in mobile devices coupled to them withimprovements as described herein. Further in FIG. 2, an on-chip LCDcontroller and associated PWL (Pulse-Width Light) block in interfaces1410 are coupled to a color LCD display and its LCD light controlleroff-chip.

Further, on-chip interfaces 1410 are respectively provided for off-chipkeypad and GPIO (general purpose input/output). On-chip LPG (LED PulseGenerator) and PWT (Pulse-Width Tone) interfaces are respectivelyprovided for off-chip LED and buzzer peripherals. On-chip MMC/SDmultimedia and flash interfaces are provided for off-chip MMC Flashcard, SD flash card and SDIO peripherals.

In FIG. 2, a WLAN integrated circuit 1500 includes MAC (media accesscontroller) 1510, PHY (physical layer) 1520 and AFE (analog front end)1530 for use in various WLAN and UMA (Unlicensed Mobile Access) modemapplications. PHY 1520 includes blocks for Barker coding, CCK, and OFDM.PHY 1520 receives PHY Clocks from a clock generation block supplied withsuitable off-chip host clock, such as at 13, 16.8, 19.2, 26, or 38.4MHz. These clocks are compatible with cell phone systems and the hostapplication is suitably a cell phone or any other end-application. AFE1530 is coupled by receive (Rx), transmit (Tx) and CONTROL lines to WLANRF circuitry 1540. WLAN RF 1540 includes a 2.4 GHz (and/or 5 GHz) directconversion transceiver, or otherwise, and power amplifier and has lownoise amplifier LNA in the receive path. Bandpass filtering couples WLANRF 1540 to a WLAN antenna 1545. In MAC 1510, Security circuitry supportsany one or more of various encryption/decryption processes such as WEP(Wired Equivalent Privacy), RC4, TKIP, CKIP, WPA, AES (advancedencryption standard), 802.11i and others. Further in WLAN 1500, aprocessor comprised of an embedded CPU (central processing unit) isconnected to internal RAM and ROM and coupled to provide QoS (Quality ofService) IEEE 802.11e operations WME, WSM, and PCF (packet controlfunction). A security block in WLAN 1500 has busing for data in, dataout, and controls interconnected with the CPU. Interface hardware andinternal RAM in WLAN 1500 couples the CPU with interface 1410 ofapplications processor integrated circuit 1400 thereby providing anadditional wireless interface for the system of FIG. 2. Still otheradditional wireless interfaces such as for wideband wireless such asIEEE 802.16 “WiMAX” mesh networking and other standards are suitablyprovided and coupled to the applications processor integrated circuit1400 and other processors in the system.

Further described next are improved secure circuits, structures andprocesses and improving the systems and devices of FIGS. 1 and 2 withthem.

FIG. 3 illustrates an advantageous form of software modes andarchitecture 2000 for the integrated circuits 1100 and 1400. Encryptedsecure storage 2010 and a file system 2020 provide storage for thisarrangement. Selected contents or all contents of encrypted securestorage 2010 are further stored in a secure storage area 2025.

Next a secure mode area of the architecture described. In a ROM area ofthe architecture 2000, secure ROM code 2040 together with secure datasuch as cryptographic key data are manufactured into an integratedcircuit such as 1100 or 1400 including processor circuitry. Also asecure RAM 2045 is provided. Secret data such as key data is copied orprovided into secure RAM 2045 as a result of processing of the SecureROM Code 2040. Further in the secure mode area are modules suitablyprovided for RNG (Random Number Generator), SHA-1/MD5 hashing softwareand processes, DES/3DES (Data Encryption Standard single and triple-DES)software and processes, AES (Advanced Encryption Standard) software andprocesses, and PKA (Private Key Authentication) software and processes.

Further in FIG. 3, secure demand paging SDP 1040 hardware and/orsoftware effectively increases Secure RAM 1034 by demand paging fromsecure storage 2010. A hardware-implemented secure state machine (SSM)2060 monitors the buses, registers, circuitry and operations of thesecure mode area of the architecture 2000. In this way, addresses, bits,circuitry inputs and outputs and operations and sequences of operationsthat violate predetermined criteria of secure operation of the securemode area are detected. SSM 2060 then provides any or all of warning,denial of access to a space, forcing of reset and other protectivemeasures. Use of independent on-chip hardware for SSM 2060advantageously isolates its operations from software-based attacks. SSM2060 is addressable and configurable to enable a Hashing module, enablean. Encryption Decryption module, and lock Flash and DRAM spaces.

SSM 2060 monitors busses and other hardware blocks, pin boundary andother parts of the chip for security violations and protects andisolates the protected areas. SSM 2060 makes secure ROM and registerspace inaccessible, and secure RAM space inaccessible and establishesany other appropriate protections to additionally foster security. Inone embodiment such a software jump from flash to secure ROM, forinstance, causes a security violation wherein, for example, SSM 2060produces an automatic immediate reset of the chip. In anotherembodiment, such a jump causes the security monitoring logic to producean error message and a re-vectoring of the jump away from secure ROM.Other security violations would include attempted access to reconfigurethe SSM 2060 or attempted access to secure RAM space.

In FIG. 3, a kernel mode part of the software architecture includes oneor more secure environment device drivers 2070. Driver 2070 of FIG. 3suitably is provided as a secure environment device driver in kernelmode.

Further in FIG. 3, a user application 2080 communicates to and through asecure environment API (application peripheral interface) softwaremodule 2085 to the secure environment device driver 2070. Both the userapp 2080 and API 2085 are in a user mode part of the softwarearchitecture.

A protected application 2090 provides an interface as security maypermit, to information in file system 2020, secure storage 2025, and atrusted library 2095 such as an authenticated library of software forthe system.

Some Demand Paging embodiments herein provide a way to execute largeprotected applications (PA) inside Secure RAM in three phases: 1)creation of HW Security Protected Pages, and when a page fault isgenerated: 2) Swapping Out a page and 3) Swapping In a page. A pagefault occurs when a page which is not in the Secure RAM is accessed. Ituses the DRAM as a swap file device and swaps pages securely out and in,as between Secure RAM and non-secure DRAM. Page replacement selects apage for phases 2) and 3) when the Secure RAM physical pages availableto the embodiment are currently all occupied. The newly freed page isused by secure demand paging for a different part of secure applicationscode/data at a different virtual address. If tampering has occurred theSecure Swapper notifies the secure kernel and security breach countermeasures are invoked. The demand pager herein, or its calling page faulthandler, then does an instruction restart for the page faulting PA, andthe PA is never aware that the data was missing, because it is replacedby the demand paging system transparently.

Phase 1. Creation of HW Security Protected Pages is done when a PA isloaded into Secure Mode or at boot time. The Applications loaded intoSecure Mode are signed and authenticated. While authenticating theapplication, the Demand pager loads the application in 4 k chunks orpages. A hash of the PA is computed over each of these pages. Each pageis converted into a Formatted Code Page or a Formatted Data Page.

For example, a formatted page includes a descriptor block that containsthe application identifier, page identifier, timestamp, and othermanagement information such as used to administer page replacementscavenging as described herein. The page includes actual encrypted codeor encrypted data and an integrity check value. The integrity check isdone using HMAC (Hashed Message Authentication Code hashed over thecode/data and descriptor block) or another integrity process on thepage. In this way, not only is performance enhanced but also a differenthash result occurs each time the page/code is swapped in, therebythwarting replay attack scenarios. An example of an HMAC is a privatehash that is computed by taking a confidential key and pre-pending tothe data to be hashed while utilizing CBC (cipher block chaining) in thehashing process. This results in a secure hash which secures the SHA orMD5 hash better, particularly when the hash is stored publicly alongwith the data which has been hashed.

A Key for doing the encryption/decryption is a hardware-basedApplication Encryption Key accessible only inside Secure Mode, forinstance. The key used for integrity is an Application Integrity Keyaccessible only inside Secure Mode. After the last page is loaded (thismay imply removal of some pages—using page replacement algorithms), theapplication signature is verified. The result of verification is storedin Secure RAM as a tuple (Application ID, Result)

Phase 2. Page Swapping In.

For a Code Page

Verify Integrity/HMAC (using Application Code Integrity Key)

Verify App ID with the tuple table in Secure RAM

Update time stamps and any other management information in descriptorblock

Use Code Page

For a Data Page

Decrypt Data (using Application Data Decryption Key)

Verify Integrity/HMAC (using Application Code Integrity Key)

Verify App ID with the topic table in Secure RAM

Update time stamps and any other management information in descriptorblock

Use Data Page

Phase 3. Page Swapping Out.

For Code Page

Update time stamps and any other management information in descriptorblock

Compute Integrity/HMAC (using Application Code Integrity Key)

Swap out Code Page

For Data Page

Update time stamps and any other management information in descriptorblock

Compute Integrity check (using Application Data Integrity Key)

Encrypt Data (using Application Data Encryption Key) and

Swap out Data Page

The secure creation of pages, and secure swapping in and out of pagescan be applied to any demand paging scheme. Hardware and/or softwaresecurity is provided for encryption and data integrity verification (andwith generic keys).

The demand pager need not actually distinguish between code and datapages and can treat them like data pages, such as when the demand pagerhas no knowledge about the structure of the pages. The code pages arethen be treated like the data pages in terms of encryption, HMAC etc. IfHMAC is not used, it can be substituted with encrypted hash over theencrypted code/data. This confers efficient usage of DMA (Direct MemoryAccess).

To select a Secure RAM page for replacement, the demand pager hereinsuitably uses any one or combination of processes such as LFU (LeastFrequently Used), OPT, FIFO, Clock, Second-Chance, and LRU (LeastRecently Used). The demand pager is suitably used to improve compatibleexisting devices by loading by loading it as a Protected Application(PA) or Primary Protected Application (PPA) without ROM code changes.

This simple, flexible, secure solution for paging provides a virtualmemory capability securely with cryptographic components. Moreover,because DRAM is used for the swap device, it provides a very highperformance secure virtual memory system that can virtually extend thelimited secure RAM size by many times, thus to provide practicallyunlimited secure application size without the cost of more secure RAM.

The demand pager herein provides swaps that are orders of magnitudefaster than traditional hard disk drive page swaps. The Secureenvironment memory is significantly expanded without increasing SoC(System on a Chip) Secure static RAM size. This results in enablinglarger secure applications without a corresponding increase in chip costor size. Security solution trends such as TCG (Trusted Computing Groupindustry group) TPM (Trust Protection Model), OMA DRM (Open MobileAlliance digital rights management) and Windows DRM, Secure File systemsand others, which now and in the future require much more secure memorythan current SoC System-on-a-Chip static RAMs provide for, aresupported.

In one DRM example, items of music content are provided in a librarywith respective keys. A DRM Agent at a web site supplies key and contentin response to a download request from the mobile device. The digitalrights permit listening to the music content for a very limited periodof time until, for example, the user pays for the music, whereupon a keyis supplied from the web site that is used by the DRM software to playthe music indefinitely. DRM represents a case where streaming media suchas audio and/or video is subjected to security controls and is processedin real time. The Secure Demand Paging (SDP) methods and apparatus runthese applications so that the user experiences continuous streamingcontent. The improvements herein also facilitate electronic commercetransactions, secure network communications, secure displays, and securekeyboards with secure input and output.

The cell phone and other platforms are now desirable as a ubiquitousplatform for audio and video content and large applications like games,e-commerce, e-mail, internet voice and video, and other applications.Significant content applications and significant software applicationsare supported according to the teachings herein in a manner thataccommodates and enhances the security and digital rights managementthat users and providers would require in a high-computing-performance,power-limited, hand-carried or body-wearable platform that isinexpensive enough to attract mass distribution.

SDP 1040 includes a SDP PPA to provide an on-demand memory managementtranslation layer or interface (MMTL), among its other aspects. SDP PPAmediates and overcomes differences in memory management High LevelOperating Systems (HLOS) usage models between the secure state and thenon-secure state code typified by complex memory management arrangementsthat do not map physical memory linearly into the virtual address space.Secure Environment (SE) ROM code desirably is embedded physically in theapplications processor chip for security. Cryptographic operations arealso provided by hardware accelerators in an elegant manner with lowprocessing burden.

Because changes to the ROM can be inconvenient and expensive, the SDPPPA suitably acts as a memory management translation interface so thatthe same SE ROM code serves differing HLOS, different applications, anddifferent system configurations. SDP PPA is suitably included in an SEdriver for a particular HLOS or provided separately and coupled to sucha driver, SDP PPA thus also simplifies design verification for security.

In some embodiments, SE ROM code operates with all virtual addressesmapped Virtual-to-Physical to impede and abrogate MMU attacks fromnon-secure code, as well as to be OS agnostic. SDP acting as MMTL is,for example, directly coupled to the application and directly respondsto parameter data from the application that requested the securityservice without need of a performance-complicating prior-reserved andphysically-contiguous buffer or redundant-copy memory for largeparameter blocks. Re-alignment processing is also avoided in embodimentsthat align data on physically contiguous 4K pages.

SDP PPA intelligently finds physical pages on demand containing orpertaining to secure parameters of user that were inputs to a secureservice function call. SDP PPA responds effectively to page faults ordata abort exceptions that can occur when secure state PA code does notknow where to find the parameter data. The SDP PPA page fault handlerthen is automatically invoked by the data abort exception and delivers amapping and access of virtual page address(es) to underlying physicalpag(es).

Three exemplary patch points for SDP PPA to couple to legacy SE ROM code2040 are suitably provided as follows: 1) Data Abort Exception vectorintercept, and also (if used) Prefetch Abort vector intercept. Patchpoint should pass control to PPA patch with all registers intact at timeof abort. 2) ROM API entry after secure entry at a point where all APIinput parameters can be examined, optimizes for smaller amounts of datapassed so that no Data Aborts occur on small data which should alreadybe copied to contiguous RAM. 3) ROM exit before cleanup where API returnparameter can be examined.

Turning to FIG. 4, a Secure Demand Paging (SDP) 1040 secure hardware andsoftware mechanism desirably has efficient page wiping for replacementin internal Secure RAM 1034 of physical pages not currently or oftenused by the software application, such as protected application 2090.Such pages include pages that may or may not need to be written back toexternal or other memory.

An SDP 1040 hardware and software process efficiently governs thefinding of appropriate pages to wipe and various embodiments conferdifferent mixes of low complexity, low memory space and chip real-estatespace occupancy, and low time consumption, low power consumption and lowprocessing burden. The quality of the choice of the page to wipe out forreplacement is advantageously high. “Wipe” includes various alternativesto overwrite, erase, simply change the state of a page-bit that tags orearmarks a page, and other methods to free or make available a pagespace or slot for a new page.

A hardware-based embodiment efficiently identifies the appropriate pageto wipe and applies further efficient SDP swap and other structures andoperations. In this embodiment, a hardware mechanism monitors differentinternal RAM pages used by the SDP software mechanism. The hardwaremechanism also detects and flags via registers accessible by software,which page is Dirty (modified) or Clean (unmodified). (A Write access toa page makes it become Dirty.)

This embodiment also computes according to the ordered Read and Writeaccesses that occurred on the different pages, statistical informationabout the internal RAM page Usage Level. Usage Level is divided intoVery Low usage, Low usage, Medium Usage, and High Usage, for instance.

SDP 1040 then computes from all the information, according to anembedded sorting process, which pages are the more suitable pages to bewiped. SDP 1040 variously considers, for example, impact of each page onthe current application and the time required for a page to be wipedout. Wiping a low usage page impacts the application slightly, but ahigher usage page is needed by the application more. A Dirty pageconsumes writeback time to external memory and a Clean page does notneed to be written back. SDP 1040, in one example, prioritizes the pagesthat are more suitable to be wiped out for less time consumption andapplication impact in the following priority order:

CODE page tagged as VERY LOW usageCODE page tagged as LOW usageDATA READ page tagged as VERY LOW usageDATA READ page tagged as LOW usageDATA WRITE page tagged as VERY LOW usageDATA WRITE page tagged as LOW usageCODE page tagged as MEDIUM usageDATA READ page tagged as MEDIUM usageDATA WRITE page tagged as MEDIUM usage

Then the process logs the results to prognostic registers such as pagecounters described hereinbelow. Subsequently, the SDP software mechanismjust reds the prognostic registers to find the best pages to wipe. Seecoassigied, co-filed application U.S. non-provisional patent applicationTI-39617 “Page Processing Circuits, Devices, Methods And Systems ForSecure Demand Paging And Other Operations” U.S. Ser. No. ______, whichis incorporated herein by reference.

In the case of a strong security embodiment, the SDP 1040 hardwareand/or software just described herein is configured and accessed by themain processing unit in Secure Mode, or highly privileged modes withoutimpact on the main processing unit functionality. Restrictions on SecureMode and privilege are removed in whole or in part for less secureembodiments. Some embodiments make demand paging itself more efficientwithout an SSM 2060. Other embodiments provide security features thattogether with the improved demand paging provide a Secure Demand Pageror SDP.

Some embodiments improve very significantly the page selection mechanismwith regard to competing demands of time and power consumption, and thequality of the choice of the page to wipe out for replacement.

Some embodiments generate automatically and with little or no timeoverhead the dirty page status and the best page to wipe.

Hardware-based embodiments are often more resistant to tampering bysoftware running in other processor modes besides Secure or PrivilegedModes. That is, such embodiments are less sensitive to Denial of Service(DoS) attack on an internal mechanism which might force a softwareapplication not to run properly.

Some embodiments having Dirty page status generating circuits furtherdetect whether Code pages used in internal RAM have been modified by anattacker. This capability contributes to the security robustness of SDPpaging methods.

Any demand paging system, whether secure or not, can be improvedaccording to the teachings herein, with benefits depending on relativesystem. Swap Out times and Swap In times, and also systems wherein theaccess time mix of various types of external storage devices from whicheven the Swap hi times to on-chip RAM vary, and other factors. Theimprovements taught herein are of benefit in a Secure Demand Pagingsystem with Swaps between on-chip RAM and off-chip DRAM, for instance,because Swap Out is used for modified pages and not used for unmodifiedpages and in some systems the Swap Out time with encryption and/orhashing adds relative to the Swap In time is greater than the Swap Outtime would be in a less-secure system lacking the encryption and/orhashing.

Various embodiments are implemented in any integrated circuitmanufacturing process such as different types of CMOS (complementarymetal oxide semiconductor), SOI (silicon on insulator), SiGe (silicongermanium), and with various types of transistors such as single-gateand multiple-gate (MUGFET) field effect transistors, and withsingle-electron transistors and other structures. Embodiments are easilyadapted to any targeted computing hardware platform supporting or notsupporting a secure execution mode, such as UNIX workstations andPC-desktop platforms.

FIGS. 4 and 8 depict external storage SDRAM 1024 and secure Swapper 2160of 4K pages being Swapped In and Swapped Out of the secure environment.A process of the structure and flow diagram of FIG. 4 suitably executesinside the secure environment as an integral part of the SDP managercode. Note that many pages illustrated in the SDP 1040 are held orstored in the external SDRAM 1024 and greatly increase the effectivesize of on-chip secure memory 1034.

A multi-tier hashing data structure and process at the top level resultsin a hash which represents all the external SDP pages and book-keeping.This process, also herein called a pyramid-hash process, consumes alittle more acceptable overhead on Swap Out operations, because thebottom of the pyramid (all pages) does not need to be re-hashed, and thesecond-level tiers and higher tiers of the pyramid are recomputed. SwapIn operations consume less overhead for hashing than Swap Outoperations.

The SDP 1040 has a pool of pages that are physically loaded with dataand instructions taken from a storage memory that is suitably encrypted(or not) external to the secure mode. SDP 1040 creates virtual memorysecure mode and thus confers the advantages of execution of softwarethat far exceeds (e.g., up to 4 Megabytes or more in one example) thestorage space in on-chip Secure RAM.

In FIG. 4, Secure RAM 1034 stores a pool of 4K pages, shown as acircular data structure in the illustration. The pool of pages in SecureRAM 1034 is updated by the SDP according to Memory Management Unit (MMU)page faults resulting from execution of secure software currentlyrunning on the system.

In FIG. 4, a processor such as an RISC processor, has a MemoryManagement Unit MMU with Data Abort and Prefetch Abort outputs. Theprocessor runs SDP Manager code designated Secure Demand Paging Code inFIG. 4. The SDP Manager is suitably fixed in a secure storage of theprocessor and need not be swapped out to an insecure area.

At left, Protected Applications (PAs) occupy a Secure Virtual AddressSpace 2110 having Virtual Page Slots of illustratively 4K each. In thisway, a Secure Virtual Memory (SVM) is established. Secure VirtualAddress Space 2110 has Code pages Data pages E,F,G; and a Stack C. TheSecure Virtual Address Space as illustrated has a Code page K and a Datapage G which are respectively mapped to physical page numbers 6 and 2 instructure 2120, also designated PA2VA (physical address to virtualaddress). In some embodiments, the PA has its code secured by PKA(public key acceleration).

Some embodiments have PA2VA 2120 in FIG. 4 having Page Table Entries(PTEs) of 32 bits each, for instance. In operation, Swapped In pagesfrom the PA (Protected Application) and the PA2VA 2120 are maintainedsecure on-chip. The PTEs identify which pages are stored in Secure RAMas illustrated in FIG. 4.

One of the bits in a PTE is a Valid/Invalid bit (also called an Activebit ACT[N] herein) illustrated with zero or one for Invalid (I) or Valid(V) entries respectively. An Invalid (1) bit state in ACT[N] or in thePA2VA for a given page causes an MMU page fault or interrupt when avirtual address is accessed corresponding to a physical address in thatpage which is absent from Secure RAM. Additional page-specific statusinformation, such as bits for Locked page, Empty page, Dirty page, andother information are suitably stored for each page entry in the PA2VA.

Further in FIG. 4, a hardware arrangement is located in, associatedwith, or under control of a RISC processor. The RISC processor has anMMU (memory management unit) that has data abort and/or prefetch abortoperations. The hardware supports the secure VAS (virtual address space)and includes a Secure static RAM. The Secure RAM is illustrated as acircular data structure, or revolving scavengeable store, with physicalpages 1, 2, 3, 4, 5, 6. Stack C is swapped into physical page 5 ofSecure SRAM, corresponding with the previously-mentioned Page TableEntry 5 for Stack C in the PA2VA. Similarly, Code K is swapped intophysical page 6 of Secure SRAM, corresponding with thepreviously-mentioned Page Table Entry 6 for Code K in the PA2VA.

Associated with the Secure RAM is a Secure Swapper 2160. Secure Swapper2160 is illustrated in FIGS. 5-8 and has secure Direct Memory Access(DMA) that feeds AES (encryption) and SHA (hashing) hardwareaccelerators. The secure swapping process and hardware protect the PAinformation at all times.

In FIG. 4, coupled to the Secure Swapper DMA 2160 is a non-secure DRAM1024 holding encrypted and authenticated pages provided by SDP secureswapper 2160. The DRAM pages are labeled pages A, B, C (mapped tophysical page 5), D, E, F, G (mapped to physical page 2), H, I, J, K(mapped to physical page 6), and L.

SDP hardware provides secure page swapping, and the virtual addressmapping process is securely provided under Secure Mode. Code and Datafor SDP Manager software are situated in Secure RAM in a fixed PPA(primary protected application) memory address space from which swappingis not performed. Execution of code sequences 2150 of the SDP Codecontrol Secure Swapper 2160. For example, a High Level Operating System(HLOS) calls code to operate Public Key Acceleration (PKA) or secureapplet. The PKA is a secure-state application (PA) that is swapped intoSecure RAM as several pages of PKA Code, Data and Stack.

In FIG. 4, a number N-1 Valid Bits exist in the page entries of thePA2VA 2120 at any one time because of a number N (e.g. six in theillustration) of available Secure RAM 1034 pages. In some embodiments,one spare page is suitably kept or maintained for performance reasons.Page Data is copied, swapped, or ciphered securely to and from the DRAM1024 to allow the most efficient utilization of expensive Secure RAMspace. In Secure RAM 1034, pages are positioned exactly at the virtualaddress positions where they are needed, dynamically and transparentlyin the background to PAs.

In FIG. 4, SDP software coherency with the hardware is maintained by theMMU so that part of the software application is virtually mapped in aSecure OS (Operating System) virtual machine context VMC according toVirtual Mapping 2120. In this example, the VMC is designated by entries“2” in a column of PA2VA. A locked asynchronous messaging destinationpage for a VMC designated “5,” for instance, is set up by establishingan entry “5” (not shown) in the VMC column of PA2VA at a row pertainingto the physical address in Secure RAM at which the virtual address ofthat destination page is mapped. Setting up and using such pages arediscussed in connection with FIGS. 25 and 27 and elsewhere herein.

If a context switch is performed, then the VMC entries in PA2VA arechanged to a new VMC identification number. The part of the softwareapplication is that part physically located in the Secure RAM and has aPhysical Mapping 2120 according to a correspondence of Virtual Pages ofVirtual Mapping 2110 to respective physical pages of the PhysicalMapping 2120.

The information representing this correspondence of Virtual Mapping toPhysical Mapping is generated by the MMU and stored in internal buffersof the MMU.

The virtual space is configured by the MMU, and the DRAM 1024 isphysically addressed. Some embodiments use a single translation vectoror mapping PA2VA from the virtual address space to physical addressspace according to a specific mapping function, such as by addition (+)by itself or concatenated with more significant bits (MSB), given as

Virtual_address_space=phy_address_space+x,

where x is an MSB offset in an example 4GBytes memory range [0:4 GB]+y,and where y is an LSB offset between the virtual address and thephysical address in Secure RAM.

In FIG. 4 the scavenging process puts a new page in a location inphysical Secure RAM 1034 space depending on where a previous page isswapped out. Accordingly, in Secure RAM space, the additionaltranslation table PA2VA 2120 is provided to provide an LSB addressoffset value to map between the virtual address and the physical addressin Secure RAM. MSB offsets x are stored in a VMC_MMU_TABLE in SecureRAM.

In some mixed-memory embodiments DRAM 1024 has enough shorter accesstime or lower power usage than Flash memory to justify loading and usingDRAM 1024 with pages that originally reside in Flash memory. In otherembodiments, SDP swaps in PA from Flash memory for read-only pages likePA code pages and the PA is not copied to DRAM. In still otherembodiments, parts of the PA are in Flash memory and other parts of thePA are copied into DRAM 1024 and accessed from DRAM 1024. Accordingly, anumber of embodiments accommodate various tradeoffs that depend on,among other things, the relative economics and technology features ofvarious types of storage.

In establishing Mappings 2110 and 2120 and the correspondencetherebetween, the following coherency matters are handled by SDP.

When loading a new page into Page Slot N in Secure RAM as described inFIG. 5, the previous Virtual to Physical mapping is no longer coherent.The new page corresponds to another part of the source application. TheVirtual Mapping 2110 regarding the Swapped Out previous page N isobsolete regarding Page N. Entries in the MMU internal buffersrepresenting the previous Virtual to Physical Mapping correspondence arenow invalidated such as in a Privileged mode. The SSM 2060 is used toenforce the security. An access to that Swapped Out page generates aPage Fault signal.

Analogously, entries in an instruction cache hierarchy at all levels(e.g. L1 and L2) and in a data cache hierarchy at all levels areinvalidated to the extent they pertain to the previous Virtual toPhysical Mapping correspondence. Accordingly, a Swapped Out code page ishandled for coherency purposes by an instruction cache rangeinvalidation relative to the address range of the Code page. A Data pageis also analogously handled by a data cache range invalidation operationrelative to the address range of the Data page. Additionally, forloading Code pages, a BTAC (Branch Target Address Cache or Branch TargetBuffer BTB) flush is executed at least in respect of the address tags inthe page range of a wiped Code page, in order to avoid taking apredicted branch to an invalidated address.

When wiping out a page from Secure RAM 1034, some embodiments include inRAM 1034 Code pages that are always read-only. Various of theseembodiments distinguish between Data (Read/Write) pages and Code (ReadOnly) pages. If the page to wipe out is a Data page, then to maintaincoherency, two precautions are executed. First, the Data cache range ismade clean (dirty bit reset) in the range of addresses of the Data Page.Second, the Write Buffer is drained so that any data retained in thedata caches (L1/L2) are written and posted writes are completed. If thepage to wipe out is a Code page, the wiping process does not need toexecute the just-named precautions because read-only Code pages wereassumed in this example. If Code pages are not read-only, then theprecautions suitably are followed.

The SDP paging process desirably executes as fast as possible whenwiping pages. Intelligent page choice reduces or minimizes the frequencyof unnecessary page wipes or Swaps since an intelligent page choiceprocedure as disclosed herein leaves pages in Secure RAM that are likelyto be soon used again. Put another way, if a page were wiped from SecureRAM that software is soon going to use again, then SDP would consumevaluable time and power to import the same page again.

An additional consideration in the SDP paging process is that the timeconsumption for wiping pages varies with Type of page. For example,suppose a Code Page is not required to be written back to the externalmemory because the Code Page is read-only and thus has not beenmodified. Also, a Data Page that has not been modified does not need tobe written back to the external memory. By contrast, a Data Page thathas been modified is encrypted and hashed and written back to theexternal memory as described in connection with FIG. 6.

FIG. 5 depicts SDP hardware and an SDP process 2200 when importing a newpage from SDRAM 1024. Consider an encrypted application in the SDRAM1024. The description here equally applies to Code pages and Data pages.A step 2210 operates so that when a new page is needed by a processorand that page is missing from Secure RAM 1034, then that page is readfrom an application source location in the SDRAM 1024. Next a step 2220performs a Secure DMA (Direct Memory Access) operation to take the newpage and transfer the new page to a decryption block 2230. In a step andstructure 2240, the decryption block 2230 executes decryption of thepage by AES (Advanced Encryption Standard) or 3DES (Triple DataEncryption Standard) or other suitable decryption process. As theAES/3DES accelerator 2230 is decrypting the content, the output of theAES/3DES accelerator 2230 is taken by another Secure DMA operation in astep 2250.

Then, in FIG. 5, Secure DMA overwrites a wiped Secure RAM page with thenew page, e.g., at page position Page 4 in the Secure RAM 1034. Further,Secure DMA in a step 2260 takes the new page from Secure RAM 1034 andtransfers the new page in a step 2270 to a hashing accelerator 2280 inprocess embodiments that authenticate pages. The hashing accelerator2280 calculates the hash of the new page by SHA1 hashing or othersuitable hashing process to authenticate the page. Block 2280 alsodetects any time stamp accompanying the page. A comparison structure andstep 2285 compares the page hash with a predetermined hash value. Timestamp values are suitably compared along with, or instead of the hashes.If the page hash fails to match the predetermined hash value, or thetime stamp comparison fails, the page is wiped from Secure RAM in a step2290, or alternatively not written to Secure RAM 1034 in step 2250 untilthe hash authentication is successful. If the page hash matches thepredetermined hash value for that page, the page remains in Secure RAM,or alternatively is written to Secure RAM by step 2250, and the page isregarded as successfully authenticated. A suitable authenticationprocess is used with a degree of sophistication commensurate with theimportance of the application.

FIG. 6 depicts an SDP process 2300 of wiping out and Swapping Out apage. The SDRAM, Secure RAM, Secure DMA, encryption/decryptionaccelerator 2330, and hashing accelerator 2390 are the same as in FIG.5, or provided as additional structures analogous to those in FIG. 5.The process steps are specific to the distinct SDP process of wiping outa page such as Page 4. In a version of the wiping out process 2300, astep 2310 operates Secure DMA to take a page to wipe and Swap Out, e.g.,Page 4 from Secure RAM 1034. A step 2320 transfers the page by SecureDMA to the AES/3DES encryption accelerator 2330. Then in a step 2340 theAES/3DES encryption accelerator encrypts the content of the page. SecureDMA takes the encrypted page from AES/3DES encryption accelerator in asucceeding step 2350 and transfers and writes the page into the externalSDRAM memory and overwrites the previous page therein. In the process,the wiped out Page 4 information may be destroyed in the internal SecureRAM 1034, such as by erasing or by replacement by a replacement pageaccording to the process of FIG. 5. Alternatively, the Page 4 may bewiped out by setting a page-specific bit indicating that Page 4 iswiped.

In FIG. 6 a further SDP process portion 2360 substitutes for step 2310the following steps. Secure DMA in a step 2370 takes the page fromSecure RAM 1034 and transfers the page in a step 2385 to the hashingaccelerator 2390 in process embodiments involving authenticated pages.The hashing accelerator 2390 calculates and determines the hash value ofthe new page by SHA1 hashing or other suitable hashing process. In thisway, accelerator 2390 thus provides the hash value that constitutes thepredetermined hash value for use by step 2285 of FIG. 5 in looking for amatch (or not) to authenticate a page hash of a received Swapped Inpage. Block 2390 also suitably time stamps the page header along withhashing, or in lieu of hashing. The page content of Page 4 and thethus-calculated hash value are then obtained by Secure DMA in a step2395 whereupon the process continues through previously-described steps2320, 2330, 2340, 2350 to write the page and hash value to the externalmemory SDRAM 1024.

In FIG. 7, AES/xDES block encryption/decryption functional architectureincludes a System DMA block 2410 coupling Secure RAM 2415 to encryptionHWA 2420. A RISC processor 2425 operates Secure Software (S/W) in SecureMode. On Swap Out, an encrypted data block is supplied to Memory 2430such as a DRAM, Flash memory or GPIOs (General Purpose Input/Outputs).The decryption process on Swap In is the same as the one described inFIG. 7 but with memory 2430 as data block source and Secure RAM 2415 asdata block destination.

Now consider the flow of an encrypted Swap Out process executed in FIG.7. In a step 2450, RISC processor 2425 in Secure Mode configures the DMAchannels defined by Internal registers of System DMA 2410 for datatransfer to cryptographic block 2420. Upon completion of theconfiguration, RISC processor 2425 can go out of secure mode and executenormal tasks. Next, in a step 2460 Data blocks are automaticallytransferred from Secure RAM via System DMA 2410 and transferred in step2470 to encryption block 2420 for execution of AES or xDES encryption ofeach data block. Then in a step 2480, Data blocks are computed by thechosen HWA (hardware accelerator) crypto-processor 2420 and transmittedas encrypted data to System DMA 2410. The process is completed in a step2490 wherein encrypted Data blocks are transferred by DMA 2410 to memory2430.

In FIG. 8, SHA1/MD5 Hashing architecture includes the System DMA block2410 coupling Secure RAM 2415 to Hash HWA 2520. RISC processor 2425operates Secure Software (S/W) in Secure Mode. System DMA 2410 hasInternal Registers fed from the RISC processor. Hash block 2520 hasResult registers coupled to the RISC processor. An Interrupt Handler2510 couples Hash block 2520 interrupt request IRQ to the RISC processor2425.

The flow of a Hash process executed in FIG. 8 is described next. In astep 2550, RISC processor 2425 in Secure Mode configures the DMAchannels defined by Internal registers of System DMA 2410 for datatransfer to Hash block 2520. Upon completion of the configuration, RISCprocessor 2425 can go out of secure mode and execute normal tasks. Next,in a step 2560 a Data block is automatically transferred from Secure RAM2415 via System DMA 2410 and transmitted in step 2570 to Hash block2420. A hash of the data block is generated by the chosen HWAcrypto-processor 2520 by SHA-1 or MD5 or other suitable Hash. In asucceeding step 2580, HWA 2520 signals completion of the Hash bygenerating and supplying interrupt IRQ to Interrupt Handler 2510.Interrupt Handler 2510 suitably handles and supplies the hash interruptin a step 2590 to RISC processor 2425. When the interrupt is received,if RISC processor 2425 is not in Secure Mode, then RISC processor 2425re-enters Secure Mode. The process is completed in a step 2595 whereinRISC processor 2425 operating in Secure Mode gets Hash bytes from Resultregisters of HWA 2520 and delivers them to Secure RAM 2415.

FIGS. 9A-9E show structures and operations thereon progressing insequence in the order of the FIGS. 9A-9E in the manner of an animationvisual. Structures are diagrammatically emphasized and de-emphasizedvariously in FIGS. 9A-9E to more effectively depict the operations. Eachof FIGS. 9A-9E is divided approximately in half with a Non-SecureExecution State at left and a Secure Execution State or environment atright. The Secure Execution environment (S.E.) at right is protected bya hardware Secure State Machine 2060 of FIG. 3. The Non-Secure ExecutionState has a Non-Secure Virtual Address Space (VAS) 2830 with virtualpage slots holding a Non-Secure Client Application and Parameters andData for that Client Application.

HLOS (High Level Operating System) Page Tables 2840 refer to virtualpage slots of VAS 2830 in the Non-Secure Execution State. The SecureEnvironment (S.E.) has S.E. Page Tables 2850 which refer to virtual pageslots in a Secure Virtual Address Space (VAS) 2860. The page slots ofVAS 2860 hold a Protected Application (PA) and Parameters and Data forthat PA. A CPU (Central Processing Unit) 1030 of FIG. 1, such as of aRISC processor, has an associated Memory Management Unit (MMU) which isable to access the HLOS Page Tables 2840 when the system is in eitherSecure Mode or not, and is able to access the S.E. Page Tables 2850 whenthe system is in Secure Mode. In the non-secure world of the processor,the HLOS controls the page tables, flushes cache and TLB (translationlookaside buffer), turns off MMU, and executes instructions to do asignature check by SSM for no cache hits. Then operations inside the MMUdoes back and load pointer to point to the Secure Page Table. Thisprocedure, in effect, confers the functionality of two MMUs for theprice of one MMU. The MMU is time-shared for both secure operations andnon-secure operations.

In FIGS. 9A-9E, a PA larger than secure static RAM (Secure RAM 1034 ofFIGS. 9C-9E, omitted for clarity in FIGS. 9A-9B) is loaded with nochanges to the Load Manager. Load Manager loads the PA without evenrealizing that the PA is larger than the actual physical secureStatic-RAM. In fact, the Load Manager needs no modifications or specialcode to handle or manage SDP (Secure Demand Paging) and thus LoadManager is and can be unaware of SDP. In some embodiments SDPtransparently or invisibly executes beneath the Load Manager, andconveniently loads PAs larger than real Secure RAM 1034.

For example, a cryptographic server library 2861 and cryptographic textparameters are mapped in the S.E. VAS 2860 and are together larger thanSecure RAM 1034. The cryptographic server library includes a Triple-DES(TDES) PA 2861, for instance. The TDES PA 2861 in part or in whole isheld in the Secure RAM 1034 when the TDES PA 2861 is executed. The restof the cryptographic server library is held in a secure manner in DRAM1024 but is not physically situated in the Secure RAM 1034.

In FIG. 9A, Client executes a Call 2855 to TDES Decryption PA 2861 andalso provides a cryptographic text virtual address pointer 2857. Toperform this Call, the MMU consults HLOS Page Tables 2840 by anon-secure HLOS Page Table access 2851. If the called program were not aPA (Protected Application), then the non-secure HLOS Page Table access2851 would ordinarily succeed in properly configured non-secure space.

In the case wherein the called program is a PA, the non-secure HLOS PageTable access 2851 fails. An operation 2856 switches the access mode tomake a secure access 2859 to S.E. Page Tables 2850. The Decryption PA2861 is available in Secure Mode. Access 2859 successfully advances theClient Call 2855 to Decryption PA 2861. Next, PA 2861 attempts a securedata access 2871 to a virtual page slot 2865 based on the pointer 2857.

In FIG. 9B, if the physical page of Secure RAM 1034 holds the datacorresponding to virtual page slot 2865, then the attempted secure dataaccess 2871 succeeds and operations proceed with execution of the TDESDecryption PA 2861.

FIG. 9B also shows the case wherein the attempted secure data accessfails because the data corresponding to virtual page slot 2865 is notpresent in Secure RAM 1034. Operations in FIGS. 9B-9E effectively expandSecure RAM 1034 by successfully bringing the secure data access tocompletion in a secure manner when the attempted secure data access 2871fails. In FIG. 9B, an operation 2871 executes an MMU Page Table walk forthe virtual access to which access is attempted based on the S.E. PageTables. MMU performs plural accesses and lookups in the S.E. Page Tablesin an operation 2875. When the attempted secure data access fails underoperations 2871 and 2875, MMU reaches a Data Abort state 2877. This DataAbort state 2877 is used as a Page Fault for SDP operations. Based onthe Data Abort state 2877, CPU makes an access 2881 to Secure ROM 2883.Secure ROM 2883 responds with an entry point address 2885 to vectoroperations to a Data Abort Handler 2887 of the SDP PPA (Secure DemandPaging Primary Protected Application).

FIG. 9C shows further aspects of operations at this point. SDP DataAbort Handler 2887 responds with one or more signals 2891 so that MMUceases access activity to the S.E. Page Tables and this cessation isindicated by “X” 2893 and “X” 2895. Data Abort Handler 2887 by signal(s)2891 activates a search 2897 in VMC VAS (Virtual Machine Context VirtualAddress Space) resented in DRAM 1024 for SDP code, data and stack (seeFIG. 10). The search 2897 finds the page that is missing from Secure RAMat virtual page slot 2899. The missing page is retrieved in an operation2905 Page Found and provided to Secure RAM 1034 as a Physical Page 2910emphasized by an outline rectangle in FIG. 9C.

In FIG. 9D, SDP operations proceed in an operation 2911 to map thePhysical Page 2910 into a virtual page slot in the Secure VAS 2860 byupdating the S.E. Page Tables 2850, analogous to PA2VA 2120 of FIG. 4.Also SDP operations Swap In the page as shown in FIGS. 5 and 7. Anoperation 2915 of FIG. 9D activates hardware accelerators to decrypt andauthenticate the Physical Page 2910 retrieved in step 2905. Ifdecryption and authentication procedure on the Physical Page 2910 areunsuccessful, an SDP error is issued and protective measures areactivated. Upon successful decryption and authentication of the PhysicalPage 2910, the Physical Page 2910 is now valid and mapped by the S.E.Page Tables 2850 as depicted by an arrow 2913 into a virtual page slot2917 in Secure VAS 2860.

In FIG. 9E, the PA proceeds with the TOES decrypt called by Client inFIG. 9A and consumes the data of the Physical Page in virtual page slot2917 of FIG. 9D. If and as the PA requires further data, the process ofFIGS. 9B, 9C, 9D (an example of Swap In of SDP) is repeated asillustrated by search and access 2921 to obtain a further Physical Page2920. SDP decrypts and authenticates the page from DRAM to obtain thefurther Physical Page 2920 and maps the further Physical Page 2920 asshown by arrow 2923 to another virtual page slot 2925 in the SecureEnvironment. The TDES PA consumes data in virtual page slots such as2925 and finishes the TDES decrypt that was called for by Client in FIG.9A. Upon completion of operations of the PA, the PA signals completion2935 back to the Client Application whereupon this example of secureoperations are completed using SDP.

TABLE 1 ACRONYMS AND ABBREVIATIONS AES Advanced Encryption Standard BByte (8 bits). CS Chip Select. DES/3DES Data EncryptionStandard/Triple-DES DMA Direct Memory Access DRM Digital RightsManagement HW Hardware HLOS High Level Operating System HMAC HashedMessage Authentication Code IRQ Interrupt. ISR Interrupt ServiceRoutine. KB Kilobyte, 1024 B. MB Megabyte, 1024 KB. MPU MicroprocessorUnit. OS Operating System. PPA Primary Protected Application. POR PowerOn Reset. RAM Random Access Memory. Internal static RAM, e.g., for appschip. ROM Read Only Memory. PA Protected Application (signed, forexecution in SE) PG Page RSA Public Key Algorithm SDP Secure DemandPaging SDRAM Synchronous Dynamic Random Access Memory. SE SecureEnvironment, protected against tampering by SSM. Sensitive code can beexecuted securely while having access to rest of SE. SHA-1 Secure HashAlgorithm, version 1 SSM Secure State Machine SVM Secure Virtual MachineSW Software VAS Virtual Address Space that SDP controls VMM VirtualMachine Manager. See also VMC-Switch description.

TABLE 2 DEFINITIONS FOR SOME EMBODIMENTS PG Page. 4K size memory blockaligned on 4K. PHYS_SEC_PG A physical Secure RAM PG which is dynamicallymapped into different PG_SLOT positions in the VAS for creating, ineffect or in operation as if there were, a much larger secure virtualmemory. Backing Store Memory (e.g., SDRAM) to store dormant PGs whilenot slotted in VAS. Backing refers to the backup of Secure RAM by DRAMstorage. Backing Store PG Memory area that contains one SDRAM_PG and itsassociated Header. Backing Page A particular 4K page that is backing upa swapped 4K slot in the VAS. Pages are swapped in and out of DRAM muchfaster than conventional hard disk swap, and encrypted, decrypted, andhashed in SDP swapping. Certificate Data block that is digitally signedwith a private key. SDRAM _PG PG unit element of the Backing Store. ThisPG can be encrypted for security purposes. SDRAM _PG Header associatedwith a SDRAM_PG. Header Dirty This attribute applies to a PHYS_SEC_PGand indicates that a datum has been modified in the PG. Clean Thisattribute applies to a PHYS_SEC_PG and indicates that no datum has beenmodified in the PG. MMU Memory Management Unit - a functional subsystemof a microprocessor which allows dynamic memory remapping and allows SDPand other advanced memory management capabilities to occur with theproper software subsystem to manage such activity. VMC Virtual MemoryContext - Tracking Structure for a Secure Process that indicates thestate of the private secure virtual address space (VAS). VMC allows VASto be maximally utilized for secure processes. VMC context switchdynamically remaps VAS for each secure process that contains a NPPA.Activate (VMC) Activation creates a VMC by initializing the BK/BBKstructure and internal SDP structure of FIGS. 11 and 12. De-activateDe-activation kills a VMC by clearing the SDP structure of FIGS. 11 and12 (VMC) pertaining to that VMC and cleans the page pool in SDP governedSecure RAM of any page pertaining to that VMC. Switch (VMC) Switchingperforms a context switch between two activated VMCs. The MMU tables areupdated and the SDP structure of FIGS. 11 and 12 is updated to indicatethe new VMC to which the switch is made. A switch can be made to thesame VMC several times during code execution. Multi-VMC Multiple VirtualMemory Contexts - Supports re-use of the same virtual address space.Re-use of VAS protects and prevents one NPPA from accessing data ofanother NPPA data because Data and Code of the other NPPA areinaccessible because not mapped into VAS at that time. Secure ModeExecution mode protected by SSM. Secure RAM and Secure ROM, and Controland Status registers of HW secure resources are made accessible inSecure Mode. Interrupt handling protects security of secure code andsecure resources in run, exit and resume. NPPA Non-Privileged ProtectedApplication with memory page attributes set to non- privileged. PPAPrivileged Protected Application. Memory page attributes set toprivileged. Supervisor PA Protected Application with memory PGattributes set to supervisor privilege. This PA will have access to anyresources of the entire platform. Also called Secure Supervisor. User PANPPA with memory page attributes set to user privilege PA2VA Allocationtable of physical pages PHYS_SEC_PG to virtual page slots PG_SLOT.PG_TRACK This array holds PG_TRACK structures for all VMCs in BackingStore. ARRAY PG_TRACK_xxx Data structure in Backing Store for one VMC.Includes Pages, Hashes, and Book Keeping structure. PG_SLOT PG_SLOT is a4K addressable area of the VAS, with or without a PHYS_SEQ_PG allocatedto the slot. Page Slot is a 4K addressable area of the secure virtualmemory, with or without a physical page actually allocated to the slot.Usage example: After a page fault, Scavenger finds a page candidate andde-slots and re-slots the page to resolve the fault. PG_FAULT Page Faultsignal generated by RISC MMU when it detects invalid PG_SLOT in VAS assignified by second-level descriptor bits low. This signal is suppliedby one example of MMU via two different exceptions, the Data AbortException and the Prefetch Abort Exception. SCAV SDP Scavenger.Frequently called to determine Secure RAM PG to be used, stolen orevicted next for resolving page fault. SCAV maintains a PA2VA array foreach VMC. Each element has a PG_SLOT index into VMC VAS. SCAV processenhances SDP performance. SDP_CFG Secure Demand Paging ConfigurationModule - A structure configured and signed by OEM, supplied in binaryform, and loaded into Secure RAM. Validated by SE prior to initializingSDP. SDP_CFG provides OEM configuration information for SDP. SDP_VMC_CFGStructure loaded in Secure RAM provides all required information at runtime for a VMC. Swap In The PG retrieval operation from Backing Store,which occurs when PG- FAULT occurs, to load the appropriate code or datainto a PHY_SEC_PG which is re-slotted or re-mapped into the faultingPG_SLOT. Swap Out The PG backup operation to the Backing Store performedwhen a modified PHY-SEC-PG is identified by the Scavenger to be wiped.Virtual Memory An architecture wherein memory or CPU address space isstatically or dynamically re-mapped via some MMU address translationhardware. Control of that address translation hardware, via eithersoftware, hardware or both, can greatly differ from one implementationof virtual memory to the next. Wiping advice Identifying a PHYS_SEC_PGor PG_SLOT by Scavenger as being the Least (Page) Used PG or otherwisehighest priority for wiping. Unmodified Data pages and unmodified Codepages are typically higher priority for wiping since no Swap Out isinvolved, In an environment lacking self- modifying code, Code PGs areunmodified by definition. Wipe (Page) Wiping clears a page bit or otherentry pertaining to a physical page in internal RAM such as Secure RAMso that the physical page is available to be cleared by a Page Clearmode or replaced by Swapping. Wiping is different from Swapping. Flush(Page) Outside a wiping advice process or based on differentconsiderations than wiping advice, page flush identifies a specific pageto be wiped, such as prior to Swapping in a locked page having samevirtual address offset value but in another VMC than the flushed page.DRAM-SWAP Another name for Backing Store. A physically contiguous areaof non-secure DRAM which is utilized for the backing of SDP-created VAS.Pages are swapped in and out of DRAM much faster than conventional harddisk swap, and encrypted, decrypted, and hashed in SDP Swapping.

SDP provides security with much greater extensibility and flexibilitythat increases performance and security using a limited resource, theinternal Secure SRAM 1034.

The Secure Demand Paging (SDP) herein is provided between internal,on-chip Secure RAM 1034 and external, off-chip DRAM and endowed withsecure cryptography extensions added to Swap operations for purposes ofinsuring that data which is swapped out to SDRAM will remain secure andbe integrity-checked for unauthorized modification. The Secure RAM 1034is internal on-chip. Hardware security, such as SSM 2060, isolates andprevents external chip pins from being used to electronically monitor,snoop, or eavesdrop on secure applications execution on-chip. SDPsecurely bridges the internal-external divide between Secure RAM and offchip DRAM and solves security, memory space, processing burden and realestate issues.

SDP benefits secure application processors by running programs eachlarger in size than the integrated on-chip secure memory would allowwithout SDP. The underlying SDP memory management hardware and softwaretransparently operate, such as on an interrupt (or exception vector)basis. The secure applications developer can write such applications asflat and large as desired and need not consider secure code memory spaceissues because constraints on secure memory space are obviated orgreatly reduced. The secure applications software need not be aware thatPG data may be initially absent from Secure RAM 1034. The Swapoperations are transparently done in a just-in-time manner such that therunning application program has no awareness of the swapping operationswhich are dynamically occurring to underlying pages of its program Codeand/or Data.

A Protected Application (PA) software program instead merely is limitedto the size of virtual memory (e.g. high capacity DRAM) used for SDPherein, as opposed to a much smaller (e.g., less by an order ofmagnitude or more) on-chip secure SRAM physical memory constraint whichwould be imposed without SDP. Without SDP, the on-chip secure SRAMconstraint for secure applications code is believed to forcepartitioning of any larger application into multiple overlay modules.Overlay module systems introduce even further design constraints whichrestrict simple function calling between partitioned modules as well asinduce other undesirable constraints, for fitting larger amounts ofsoftware functionally into a limited memory resource. SDP as taughtherein obviates these constraints and unnecessary complications, andinstead facilitates a much simpler secure application development.

The MMU provides a Page Fault signal 2877 of FIG. 913 to the systemcontrol code. The Page Fault (PG Fault) signal 2877 notifies controlcode in real time to Swap memory blocks at an appropriate time andmemory location for application program access. The system control coderesponds to the PG fault to swap fixed size chunks of memory (e.g., 4 KBin size) in and out of a limited primary CPU storage to a much largerexternal storage and makes the much smaller, faster and more expensivephysical memory resource such as Secure RAM 1034 virtually look muchlarger. SDP as described herein removes size constraints hithertoimposed on large secure applications such as DRM (Digital RightsManagement) applications which might otherwise be partitioned or dividedinto overlay segments and impose constraints on permitted codeoperations.

SDP creates, locates, re-uses and partitions a reserved virtual memoryaddress space for SDP and herein called Virtual Address Space (VAS). VASis created at any suitable location in virtual address space accessibleby a given processor. Other storage such as Secure ROM and I/O devicesalso use virtual addresses, and do not need to be controlled by SDPdepending on embodiment.

SDP is also applicable in a multi-process, multi-threading system. SDPre-uses the VAS by context switching the address space in time viadynamic changes to the MMU page tables. This time division multiplexingof VAS by SDP provides for multiple virtual address spaces, at points intime. In some embodiments, one particular context is active at anyparticular time. These contexts provide a basis of creating secureprocesses in SDP. Each secure process is assigned an associated VirtualMemory Context (VMC), thereby providing very secure attributes for NPPAs(non-privileged PAs).

SDP confers security wherein a PA running in a secure process isprevented from modifying or executing code in another secure process.Different. PAs are thus isolated from one another. This secure attributeoccurs when SDP permits one PA to be mapped into the address space at atime. A particular secure process is active with an executing PA, whichimplies that the secure process is currently mapped into the VAS.Accordingly, any Code or Data of another secure process or PA isprevented from being mapped into the VAS at the same time, due to theVAS context only mapping the private resources of a single secureprocess at any particular point in time. Code in one secure process hasno way of modifying or accessing code in another secure process, thusisolating the secure processes.

FIG. 10 illustrates an example of SDP VAS layout as a virtual mappingfor PAs in respective VMCs. VAS has Shared and Private spaces. Theshared space is called PA Shared VMC VAS. The private space is calledReusable Private VMC VAS Per PA.

In PA Shared VMC VAS, two areas called PA User Shared Memory and PASupervisor Shared Memory are specifically reserved and visible to allPAs at the same time.

Reusable Private VMC VAS Per PA is occupied in turn by a selected oneVirtual Memory Context (VMC) from a set of VMCs indexed in this exampleVMC[0], [1], [2], . . . [9]. A VMC includes PA private Data andcertificates, PA private Code, and PA private Stack such as for registerfile and control register contents used in context switching. Inmulti-threading embodiments, enough space for two VMCs at once isprovided so that two PM can run at the same time. Additional space isprovided for higher amounts of multi-threading as desired.

In TABLE 3, SDP Certificates and Structures include Hash Structure, BookKeeping Element (BK), Block of Book Keeping Elements (BBK), SDRAM Page,SDRAM Page Header, and VMC Configuration SDP_VMC_CFG (TABLES 5 and 6).Book Keeping Element (BK) represents the fingerprint of a specificBacking Store PG.

TABLE 3 SDP CERTIFICATES AND STRUCTURES SDP Feature ParametersDescription Hash Structure Hash Hash value results of a hashingoperation (SHA1 or SHA2, e.g.) Book Keeping Offset Offset addressElement (BK) BK Hash Hash Hash of the Backing Store PG associated withthis BK Block of Book BBK Array of 16 BK Keeping Elements (BBK) SDRAM_PGData 4K page. An Initialization Vector is randomly generated for this PGSDRAM_PG Header Security_ Bit 0: Integrity criteria Bit 1:Confidentiality Status Bit 2: Confidentiality Requirement Bit 3: Code(0)/Data(1) IV Initialization Vector randomly generated for this PG HashHash of the PG

In FIG. 10 the virtual mapping example for a PA has the VAS split orpartitioned so that the Stack is located at the bottom of the VAS toimpede or prevent Buffer Overflow Attack. Code is just located above theStack. Data and Heap are next higher in the VAS. At top of the VAS, thePA Shared VMC VAS is reserved in common for all the PAs, and can beutilized for interprocess communications. Each PA suitably uses this VASlayout, and allocation of the memory spaces is flexible.

Buffer overflow attacks occur in a variety of forms. Assume the stack isdesigned to be used for all kinds of data. High level code calling downseveral levels, local or automatic variables, and function passingoperation may thread return addresses, pointers and parameters onto thestack. Using the stack in Secure RAM to point to unauthorized softwarecode is impeded or prevented.

Security in FIGS. 9 and 10 offers various levels of difficulty orbarriers to certain classes of attacks, such as not only protectingregions of code and data but also protecting the stack contents andstack size from including a return address outside an authorizedprotected range. A Security State Machine (SSM) based approach ofpreventing buffer overflows creates and isolates hardware based isolatedregions inside secure mode. These isolated regions are used to executePAs.

For instance, in FIG. 10, if a buffer overflow attack pushes the stackdown excessively, the stack expands down to an address that SSM detectsas a security violation, SSM is arranged to act as a monitoring circuitcoupled to check for containment of the stack and detect expansion ofthe stack beyond a predetermined address boundary. Data structures inFIG. 11 also suitably are provided with unused addresses, unused pageslots or other guard band areas respectively situated in, on, or outsideeither or both of the high address side and low address side of the datastructure to impede buffer overflow attack as well. The combination ofthe various structures and processes described herein provides furtheraspects of security as well. A buffer overflow protection (BOP) examplefurther includes a filter to abrogate or prevent non-secure code beingplaced into secure buffers. The filter includes an address decoder thatmonitors accesses to the stack and any other security-sensitive bufferor storage elements. The address decoder distinguishes address offsets,literals and similar authorized data in compiled code.

An additional aspect protects physical addresses from unauthorizedmodification of a page table that would map another physical page into agiven virtual address. The page tables 2840 of FIG. 9A are modifiedlegitimately by the HLOS in non-secure environment. For secure accesses,S.E. Page Tables 2850 including PA2VA are held in Secure space in FIG.11 and thus protected. Kernel ROM code swap out with a RAM page toinsert a breakpoint when the kernel runs from flash memory is protected.Thus, to protect the kernel, the SSM is suitably made to respectivelymonitor SDP and flash (EMIF/CF) regarding any attempt to unauthorizedlymodify PA2VA or to rewrite the Flash memory.

FIG. 11 depicts organization or partitioning into physical memory layoutfor Secure RAM 1034. Memory space 3110 is allocated to a VMC for a PAexecution and includes a Pool of PHYS_SEC_PG_Data, a Pool of PHYS_SEC_PGCode, and a VMC Stack.

Further in FIG. 11, Secure RAM space allocated to Primary ProtectedApplication (PPA) execution includes space 3120 for Code, Data and Heap.In other words, code and data space 3120 in Secure RAM is provided forthe SDP PPA software itself, as depicted in FIG. 11.

Secure RAM spaces allocated to Global Variables that are global to theSecure ROM Code for SDP includes 1) SDP Internal Secure StorageSDP_INT_SEC_STORAGE 3160 used by the SDP External Secure Storage Manager(4250 of FIG. 17), 2) space SDP_VMC_CFG 3150 allocated for the currentVMC, and 3) the initialization information SDP_CFG 3130 from the SDPCertificate.

SDP PPA Code and Data 3120, for instance, are suitably and flexiblylocated in an address space above or below the SDP_INT_SEC_STORAGE 3160and SDP_VMC_CFG 3150 spaces that act as PA-specific private securestorage. Different embodiments trade off allocation of SDP code betweenSecure RAM and Secure ROM space. In some cases, part of the SDP code mayreside in a space 3120 and at least part of the SDP code is suitablystored in Secure ROM to preserve a larger Secure RAM page space foractual SDP swapping operations and enhanced performance. In other casesSecure ROM may be reserved to legacy ROM code and SDP PPA resides aspace 3120 in sufficient-sized Secure RAM. SDP PPA is protected by anysuitable method from modification such as from tampering by anunauthorized alteration or write into SDP PPA or swapping out. Theprotection is facilitated such as by hardware protection of SDP PPA bySSM from impermissible accesses to SDP PPA, and protection bit(s) andlock bit(s) in secure register(s) to identify SDP PPA as protected at alevel appropriate to its functions.

A Secure RAM space 3180 allocated to Stack and Data of the Monitor andSecure Kernel includes 1) Monitor and Secure Kernel Shared Data, 2)Secure Kernel Stack, and 3) Monitor Stack.

TABLE 4 describes the information structure SDP_CFG 3130. StructureSDP_CFG 3130 is a global variable to the SDP and is imported from theSDP_Certificate and stored into the Secure RAM 1034.

TABLE 4 (SECURE RAM) SDP-CFG STRUCTURE 3130 Parameters DescriptionNUM_VMC If NUM_VMC>1, multiple VMCs are activated, e.g., formulti-threading and/or security compartmentalization. SDRAM_SDP_SIZEThis size is linked to the number of VMCs, given that each VMC has amaximum VAS (e.g., 1 MB). It is possible to restrict this size globallyto satisfy some memory constraints. PHYS_SEC_PG _NUM This parameterindicates the number of PHYS_SEC_PG in Secure RAM reserved for the SDPand of page type permitted by CODE_DATA. CODE_DATA 11-Both Code and Dataare demand paged. 10-Data only is demand paged. 01-Code only is demandpaged 00-Neither Code nor Data is demand paged. SDP off.SDRAM_BACKING_STORE_ADDR Represents the start address of Backing Storememory area 3200A. Variable is set in the SDP Certificate. Value isinitialized at Boot Time by the SDP_BOOT_INIT. SDRAM_BK_EXT_STORAGE_ADDRRepresents the start address of the memory area reserved in SDRAM forthe SDP_ EXTERNAL_SEC_STORAGE Structure 3200B. Variable is set in theSDP Certificate. Value is initialized at Boot Time by the SDP_BOOT_INIT.SEC_RAM_SDP_PHYS_START_ADDR This address is 4K aligned and representsthe physical address of the Secure RAM area reserved for the SDP.Variable is set in the SDP Certificate. Value is initialized at BootTime by the SDP_BOOT_INIT. PG_HASH_KEY Key for page hash calculationPG_CRYPTO_KEY Key for page encryption

Different PAs use software and hardware more efficiently by providingsystem-specific PA-specific SDP operating modes. For example, in a casewhere the Data is largely keys, Code may occupy a high proportion ofpages compared to Data, and so CODE_DATA from TABLE 4 is set to “01”(Code only is demand paged) in SDP_CFG 3130. This mode puts the Data insecure RAM and exempts the Data from the SDP page wiping advisorprocess. Instead, the secure demand paging is directed to paging of thesoftware Code pages, so that this mode provides a Code-paging-only typeprocess embodiment. In a second mode “11” both the code and data aresubject to SDP page wiping advisor process to provide a dual-functionprocess. Thus, configuration field SDP_CFG 3130 has one or more bitsthat control the scope of the secure demand paging.

In FIG. 11 and TABLE 5, the SDP_VMC_CFG structure 3150 in Secure RAM1034 is a global variable to the full SDP module. This structure 3150 isbuilt for a maximum VAS of 1 MB, in this example, which matches 256PG_SLOTs. Structure 3150 is stored inside the Secure RAM 1034 at a fixedaddress aligned on a 4 KB boundary. Structure 3150 contains 2nd levelMMU descriptors that are mapped by ROM. Coded 1st Level Descriptors. Inan example, the byte space for this structure SDP_VMC_CFG 3150 is on theorder of several hundred bytes for parameters plus a PA2VA having a bytespace equal to byte space for each PA2VA row multiplied times a numberof such rows equal to number of physical pages PHYS_SEC_PG_NUM.

TABLE 5 SDP_VMC_CFG STRUCTURE 3150 Parameters Description VMC_MMU_TABLEThis parameter points to the MMU 2^(nd) level [256] descriptors PGtables that are saved for the current VMC. The size of this table is 1KB (256*4 bytes). DRAM addresses for each page for each VMC are storedhere. VMC_CURRENT_ Indicates that the index of the VMC that is INDEXcurrently used VMC_ACTIVATED Indicates if the VMC has already beenactivated VMC_INDEX_LOCKED Indicates which VMC indexes are alreadyinitialized. Lock a VMC_index is performed when calling SDP_VMC_GET_NEW(). Each VMC index is bit mapped in this 32 bits pattern. VMC_PA2VA[PHYS_This array is indexed by the PHYS_SEC_PG SEC_PG_NUM] number and givesthe associated PG_SLOT number in the VAS with information on the Statusof the PHYS_SEC_PG. Structure has three entries for each physical page.Entries are: PG-VMC: Indicates which VMC_index the PHYS_SEC_PG belongsto. (e.g., 8 bits) PG-STATUS: Indicates, for each PHYS_ SEC_PG, if thePG is used (1) or not (Empty, 0); Locked (1) or not (0); Dirty (1) ornot (0), and any other suitable page status information, e.g., 8 bits.Page Activity register ACT is used when loading an application into theSecure Environment to indicate if a PHYS_SEC_PG can be considered as awipeable PHYS_SEC_ PG by the Scavenger page wiping advisor. PG_SLOTNumber A: Defines which PG SLOT in virtual space this PHY_SEC_PG isslotted to. (e.g., 16 bits). VMC_CFG_ITEM Indicate for each VMC,specific characteristics [VMC_Number] likeVMC VAS Size, VMC BaseAddress, Size of Stack, Number of Code PG, PA User or Supervisor flag,minimum number of wipeable pages MINSLOT, and PG Slot Flags.

A block VMC_CFG_ITEM in the structure SDP_VMC_CFG 3150 and tabulated inTABLE 5 and TABLE 6 has entries for VAS Size of the VMC: VMC_VAS_SIZE,and the VMC_BASE_ADDRESS, and stack size SIZE_OF_STACK, number of cedepages NUM_CODE_PHYS_SEC_PG, PA User/Supervisor flag, minimum number ofwipeable pages MINSLOT, and slot flags PG_SLOT_FLAGS,

TABLE 6 DATA STRUCTURE VMC_CFG_ITEM Parameters Description VMC_VAS_SIZEActual size of VMC VAS versus maximum size (e.g., 1M). VMC_BASE_ADDRESSBase address of VMC VAS relative to which virtual address offsets areapplied. VMC_STACK_SIZE Actual size of VMC Stack. NUMBER_OF_CODE_ Numberof CODE PGs in the Secure RAM for PHYS_SEC_PG this VMC. Remaining PGsare considered as DATA PGs. PG_SLOT_FLAGS[8] Eight patterns arc bitmapping a flag for each PG_SLOT to indicate whether or not the PG_SLOTis currently Swapped In or not. A maximum number of PG_SLOTs (e.g., 256)can be mapped in those flags. USER_NOT_ 0: VMC contains a Supervisor PASUPERVISOR 1: VMC contains a User PA MINSLOT Minimum number of wipeablepages in Secure RAM available to Scavenger page wiping advisor processfor this VMC.

FIG. 11 also shows an exploded view of structure 3160SDP_INT_SEC_STORAGE in Secure RAM, SDP_INT_SEC_STORAGE area 3160 is aGlobal Variable to the SDP and tabulated in TABLE 7. Structure 3160 is ahierarchic form of tuple table wherein the VMC index is a proxy for theapplication (PA) identification and each hash is a result of integrityverification. This structure 3160 is stored in Secure RAM in a spaceallocated for PA-specific private secure storage, and used on each SwapIn and Swap Out of PG_SLOT. Structure 3160 is a temporary structure ofthe External Secure Storage in SDRAM. Structure 3160 is initializedduring the SDP_RUNTIME_INIT( ) call of FIG. 24 described laterhereinbelow.

TABLE 7 SDP_INT_SEC_STORAGE STRUCTURE 3160 Parameters Description IndexVMC_INDEX Index of the VMC currently in use in Secure RAM BBK_INDEXIndex of the BBK currently in use in Secure RAM BK_INDEX Index of the BKcurrently in use in Secure RAM SDP_VMC_HASH[11] Stores the VMC-specifichash of the BBK hashes for each VMC and one hash of those VMC hashesBBK[BBK_INDEX] Stores the 16 BK Hashes for 16 pages of a BBK indexBBK_HASH[16] Stores the 16 BBK Hashes for the current VMC in useSDRAM_PG HEADER PG_HEADER[PHYS_SEC_PG _NUM] Keep here the SDRAM_PGHeader of all the PG_SLOTS active in the VMC INT_PATTERN IntegrityPattern [PHYS_SEC_PG _NUM] Keep here the Integrity Pattern of all theSDRAM_PG Headers used in the Secure RAM for SDP

In FIG. 11, an example of structure SDP_INT_SEC_STORAGE 3160 has 916Bplus the product of 56 times PAGE_:NUM in Bytes. Each BBK[i] has 384Band each BK[j] has 24 Bytes. A corresponding structure is also providedfor each VMC in DRAM 1024 of FIG. 12 and there corresponds inorganization to the structure SDP_INT_SEC_STORAGE 3160 of FIG. 11 inSecure RAM 1034. The SDRAM_PG_HEADER has 40 Bytes. In other examples andembodiments other numbers of bytes are used.

FIG. 12 details an external memory organization 3200. SDP interfaceswith external memory 1024 (such as SDRAM) to store run time structurescollectively designated DRAM_PG_TRACK_ARRAY that are used to load andstore data related to SDP. The SDRAM partitioning or layout has twosections 3200A and 3200B. The location addresses of the two sections aredefined in the SDP Certificate that is imported into structure SDP_CFG3130 in Secure RAM at Boot time (see FIGS. 11 and 23). These twoaddresses are SDRAM_BACKING_STORE_ADDR and SDRAM_EXT_BK_STORAGE_ADDR astabulated in TABLE 4.

In FIG. 12, the two sections are correspondingly designated SDRAMBacking Store SDRAM_BACKING_STORE 3200A and SDP External Book KeepingSecure Storage SDP_EXT_BK_SEC_STORAGE 3200B. The two sections 3200A and3200B are suitably contiguous or located separately as desired. In oneSDP example, the SDRAM Backing Store 3200A has a Page Header SDRAM_PGHeader plus a Page area SDRAM_PG, together occupying up to 10 VMCs×256page slots×4138 Bytes per page. The SDRAM External Book Keeping SecureStorage 3200B suitably has a relatively smaller but sufficient space,e.g., 61,640 Bytes.

In FIG. 12, the SDRAM Backing Store 3200A contains the entire SDRAM_PGcontiguously associated with its header. This structure 3200A isaddressed by an SDP External Secure Storage Manager (FIG. 17) after someauthentication and integrity checking of the SDP External Book KeepingSecure Storage structure 3200B. The areas SDRAM_PG and SDRAM_PG Headerare alternatively and conveniently situated in two different,non-contiguous memory areas to facilitate the access to those items byappropriately specifying and processing the SDRAM_BACKING_STORE_ADDRfield of TABLE 4.

As shown in FIG. 12 (and FIG. 11), the SDRAM_PG Header suitably has afew dozen bytes per page including Security Criteria, such as anIntegrity (Hash) Flag INTEG, Confidentiality (encryption) Flag CONFID,other security flags and criteria, and spare space. An InitializationVector IV, and a Hash of PG_SLOT are included among the DRAM_PG_HEADERfields. Next-down in the Backing Store 3200A is the page space calledSDRAM_PG, followed by a several bytes of Integrity Pattern.

In FIG. 12, the SDP External Book Keeping Secure Storage structure3200B, designated SDP_EXT_BK_SEC_STORAGE, is used to store secureinformation related to each VMC storage area in SDRAM. Some of thosesecure information items in SDRAM are preloaded as global variables intoSecure RAM 1034 for the Book Keeping (BK) element in use. Compare theFIG. 12 external structure in SDRAM with the related FIG. 11 internalstructure in Secure RAM. This SDP External Book Keeping Secure Storagestructure 3200B is managed by the SDP External Secure Storage Manager(FIG. 17).

The SDP External Book Keeping Secure Storage structure 3200B is accessedby the SDP running on the processor 1030 and generating a suitableaddress offset value. For example, this structure 3200B is built toidentify or define VMC spaces each of 1 MB size in area 3200A. The VASincludes space for ten (10) VMCs and each VMC includes 256 page slotsPG_SLOT of about 4 KB each, for example.

In FIG. 12, the SDP External Book Keeping Secure Storage structure 3200Bitself has ten portions for external VMC spaces in SDRAM:SDP_EXT_VMC[0], SDP_EXT_VMC[1], . . . SDP_EXT_VMC[9]. Altogether, theten portions occupy 61640B in this example. Each VMC-specific portion3210, such as exploded VMC[0], is divided into sixteen (16) Block BookKeeping areas BBK[0], BBK[1], . . . BBK[15], and an associated sixteen(16) Block Book Keeping Hash areas BBK_HASH[0], BBK_HASH[1], . . .BBK_HASH[15]. Each Block Book Keeping Hash BBK_HASH[i] holds the hash ofall sixteen of the Hashes of the respective Book Keeping spaces BK[i].

Further in the FIG. 12 exploded view, each Block Book Keeping areaBBK[i] is subdivided. For instance, area BBK[0] 3220 is divided intosixteen (16) Book Keeping spaces BK[0], BK[1], . . . BK[15] of 24 byteseach. Each Book Keeping space BK[i] is still further divided. Forinstance, space BK[0] 3230 is exploded to show one Hash of the BackingStore page to which this Book Keeping space BK[0] pertains, plus somespare bytes.

Appended to the SDP External Book Keeping Secure storage 3200B in SDRAMis a VMC Configuration Secure storage 3240 designatedSDP_EXT_VMC_CFG_SEC_STORAGE. This storage holds configurationinformation for SDRAM as well as a hash VMC_HASH[i] of the sixteen BlockBook Keeping hashes BBK_HASH[j] taken together for each VMCrespectively, as well as a hash SDP_HASH of all of the VMC_HASH[i] hashvalues (e.g., ten of them).

Other embodiments have fewer or more information fields for the SDPpurposes. Secure RAM of FIG. 11 holds fewer BK hashes than DRAM of FIG.12 in some embodiments.

In another embodiment, each space SDP_EXT_VMC[i] of FIG. 12 provides afurther pointer field VMC_POINTER[i] pointing to the starting address ofthe next space SDP_EXT_VMC[i+1]. In this way, a linked-list datastructure is established. Such linked-list structure occupies DRAM spaceefficiently to form either a contiguous or non-contiguous set of VMCspaces in the DRAM. The pointer field VMC_POINTER[i] is also included asan additional corresponding field in Secure RAM space SDP_VMC_CFG 3150of FIG. 11.

That space SDP_VMC_CFG 3150 acts as a temporary internal (on-chip) storefor information about the VMC[i] currently occupying Secure RAM 1034.The Secure RAM is organized to store information pertaining to pluralVMCs such as BBK hashes and VMC hashes to confirm integrity upon VMCswitching, for instance. Operations select one at a time of the VMCs asa current VMC and store selected pages from DRAM 1024 into Secure RAMprimarily from the selected current VMC out of all the activated VMCsorganized in the SDP space of DRAM 1024.

In some embodiments, the SDP_VMC_CFG space 3150 has space for only thecurrent VMC, and all other activated VMCs have their analogousinformation stored in FIG. 12 area 3240 SDP_EXT_VMC_CFG_SEC_STORAGE.Other embodiments use SDP_VMC_CFG 3150 to hold an array called hereinSDP_VMC′ ARRAY for the current VMC and all other activated VMCs inSecure RAM and back it up or not, depending on embodiment, in the FIG.12 area 3240 SDP_EXT_VMC_CFG_SEC_STORAGE.

In FIG. 12, SDP utilizes backing pages SDRAM_PG in area 3200A to back upor store pages from a VMC[i] while such pages are not active in SecureRAM from an activated VMC or are part of a VMC which is not activated atthe moment for use in Secure RAM.

A pyramid hash data structure and process embodiment as described hereinprovides equivalent security as page hash, with a tradeoff betweenprocessing speed or burden and Secure RAM space used. For example, atone end of a spectrum, a page-level hash embodiment stores hashes of allpages in Secure RAM and uses the most hash space. The page-levelprocessing performs one hash operation to hash-check the latest page,which offers a relatively fast, low amount of processing. Thispage-level hash trades off Secure RAM space for higher speed. At theother end of the spectrum, an SDP-level (all-VMC) hash check would storeone SDP hash and thus use little hash space in Secure RAM, but hash allpages of all VMCs on each Swap In or Swap Out and thereby present a highamount of processing.

An intermediate embodiment hashes a latest page being swapped to updatea set of page hashes and update the BBK hash pertaining to the BBKcontaining that latest page. The BBK hash and page hashes for that BBKare currently in the Secure RAM. All the BBK hashes for all the BBKs inthe current VMC are also stored in the Secure RAM and page hashes areswapped in from DRAM as needed for each BBK that arises in the swappingprocess. In this way, not only is an intermediate amount of Secure RAMhash space used to hold the hashes, but also the amount of processing togenerate the hashes is intermediate on the spectrum. This embodiment isuseful where the economy of Secure RAM space and the amount ofprocessing are both significant considerations. When bringing in a newBBK set of page hashes, the pre-stored BBK hash for that BBK is checkedagainst an imported BBK hash for that BBK to maintain integrity.

Another intermediate embodiment holds the page hashes and VMC hash andhashes over a whole VMC. When bringing in a new VMC set of page hashesand VMC hash, the pre-stored VMC hash for that VMC is checked againstthe imported VMC hash. To maintain integrity, Secure RAM holds the VMChash for every activated VMC. When a page is swapped in or out, the hashoperation is executed over all page hashes in the VMC. The degree towhich protected applications PA are split into several VMCs or a singleVMC affects the assessment of the tradeoffs posed by the above-describedintermediate embodiments.

Among the various embodiments of pyramid hash structure and process, theappropriate embodiment is selected by the skilled worker based on therelative importance of Secure RAM space economy and amount of processingposed.

Next, FIG. 12 is used to describe some further embodiments wherein eachvirtual memory page-slot in a particular VMC VAS has a reserved 4K DRAMpage called a DRAM Swap Page. The DRAM Swap Pages are stored as arrayelements in an array called DRAM Swap Array or SDRAM_PG of FIG. 12. TheDRAM Swap Array and each of the DRAM Swap Pages are aligned on 4Kboundaries for fast addressing. A DRAM Swap Page index is shifted leftby 12 bits for quick and efficient conversion of the index into anaddress for direct access to the particular DRAM Swap Page.

Bookkeeping or tracking structure keeps track of the DRAM Swap Page(s)in the DRAM Swap Array. Each DRAM Swap Page stored in the DRAM SwapArray is associated with a DRAM Page Tracking element in a secondexternally-stored DRAM array 3200B called DRAM Page Tracking Array. EachDRAM Page Tracking element maintains information unique to a single,corresponding, specific DRAM Swap Page in the DRAM Swap Array. The totalnumber of DRAM Page Tracking elements is also stored into the DRAM PageTracking Array.

Suppose the DRAM Page Tracking Array 3200B were too large to store inavailable Secure RAM and would reduce the remaining available memory forSecure RAM pages on which SDP functionality can depend. Accordingly, insome embodiments, DRAM Swap Pages in the DRAM Swap Array and theiraddresses (or offsets) in the DRAM Page Tracking Array 3200B aresuitably stored in DRAM 1024 and accessed in pertinent part by Swap Into Secure RAM. Special security procedures such as encryption andhierarchically-maintained hashes ensure the integrity of the DRAM PageTracking Array 3200E as described herein.

DRAM Page Tracking Array 3200B contains the associated Book Keeping BKelements for each page. The indexing of the DRAM Swap Pages in the DRAMSwap Array is arranged in some embodiments to correspond one-to-one withthe indexing of DRAM Page Tracking elements in the DRAM Page TrackingArray. This indexing correspondence as between both the DRAM Swap Arrayand the DRAM Page Tracking Array is provided for 1) robustness insecurity against replay attacks on pages, and 2) performance reasons tosimplify index-to-address conversion (one or few instructions to convertan index to an address).

DRAM Page Tracking Array 320013 size in some embodiments is made equalto a power-of-2 (two-to-Nth-power) to simplify and speed up addressingof and access to the DRAM Page Tracking elements. 32 bytes or 64 Kbytesis often large enough, and padding of a non-power-of-two minimum size issuitably provided to insure that a power-of-two is maintained for theactual size. A few padding bytes in DRAM are small compared to the 4 KBpage size of a DRAM Swap Page. Moreover, padding bytes in DRAM areinexpensive compared to padding in Secure RAM on-chip.

FIG. 13 shows another data structure and process embodiment fororganizing the SDP memory space in SDRAM and of establishing ahierarchic data structure analogous to that of FIG. 12. In FIG. 13successively exploded views further depict a data structure 3300 inphysical address space in external non-secure DRAM. Data structure 3300is hierarchically organized from an SDP top level at left, and thenrightward through successively lower levels of VMC, BBK, BK, Page, andPage_Header.

Thus, 4K pages in FIG. 13 are distributed low the Hash book keepinghierarchy and depicted as integrated into that hierarchy of FIG. 13. Bycomparison, distinct high level spaces 3200A and 320013 are depictedFIG. 12 wherein in some embodiments space 3200A has a page pool andspace 3200E has a book keeping hierarchy for hashing and administeringthe page pool of space 3200A.

The SDP level of FIG. 13 has VMCs indexed [0], [1], . . . [K−1] for atotal number K of VMCs. Corresponding Flashes of each VMC at SDP levelare Hash[0], Hash[1], . . . Hash[K−1]. Each Hash entry at SDP level isthe hash of all the Block Book Keeping BBK hashes concatenated from thenext level VMC. These Hash entries are followed by a Final_Hash entryHashing all the just-listed VMC Hashes concatenated.

Each VMC entry at SDP level is detailed at VMC level second from left inFIG. 13. Each VMC has a set of Block Book Keeping blocks BBK[0], BBK[1],. . . BBK[L−1] for a total number L of the BBKs in each VMC.Corresponding hashes of each BBK at VMC level are hash[0], hash[1], . .. hash[L−1]. Each BBK hash entry at VMC level is the hash of all theBook Keeping BK hashes concatenated from the next level BBK.

Further in FIG. 13, the next level BBK is detailed to have a set of BookKeeping elements BK[0], BK[1], . . . BK[N−1] for a total number N of BKsin each BBK. A next further level BK has a spare space for additionalinformation, a Hash space for the BK, and a 4K Page. The Hash space forthe BK holds the Hash of the 4K Page.

The Page level details the Page at BK level. At Page level, each Pagehas a Header, a data1 area having a Page Size, and a data2 area havingan EOP Size (End of Page Size). The Page_Header level details the Headerat Page level. Page_Header level has an Integrity field, aConfidentiality field, a spare field, an Initial Value IV field, and ahash field for a hash value of the page data1 area.

Different embodiments manage the physical pages in Secure RAM indifferent ways. An example embodiment divides each Protected Application(PA) into 4K pages (called data-1), and then at the end a full 4K page(called data-2) is provided regardless of amount of occupancy therein.Another approach provides 4K pages (data-1) and further providesend-of-page (EOP_Size) information for management of additional code anddata in less than a full 4K ending space (data-2).

As shown in FIG. 13 the hierarchy has increasing numbers of spaces sothere are K VMCs per SDP, K×L BBKs (Block Book. Keeping blocks), andK×L×N BKs (Book Keeping Element and their corresponding Pages.

FIGS. 14, 15, 16 show a different embodiment of data structurecorresponding to the Page_Header level and Page Level of FIG. 13. InFIG. 14, a Descriptor Block is used in both a Formatted Code page ofFIG. 15 or a Formatted Data page of FIG. 16, or either of them. TheDescriptor Block has an Application ID field, a Page ID field, a TimeStamp field, and Other Management information field. These fieldssuitably occupy the spare area identified in the Page_Header level ofFIG. 13.

In FIG. 15 a Formatted Code page has a Descriptor Block of FIG. 14followed by a page of Code (compare deal field of FIG. 13), and by anHMAC (Hashed Message Authentication Code) field.

In FIG. 16, a Formatted Data page has a Descriptor Block of FIG. 14followed by a page of Encrypted Data (compare data1 field of FIG. 13),and by an HMAC field.

FIG. 17 depicts top level components of a Secure Demand Pager SDP 4200,and high level architectural and process relationships in and betweenthem. In turn, SDP 4200 is a modular component in a larger, modularSecure Environment kernel of FIG. 3. Secure Kernel (SK) calls SDP 4200by a Call 4205 via an SDP Control Interface or SDP API. Call 4205results from a page fault PG-FAULT, for example. SDP 4200 transparentlyprovides Secure Virtual Memory (SVM) to run larger PAs than Secure RAMmemory can physically accommodate, and thereby create the effect in theSE that a much larger amount of Secure RAM exists. PA code views SVM asif it were real dedicated Secure RAM.

In FIG. 17, the top level architectural and process components and somedrawing Figures detailing them include the following list.

a Strategic Resolver 4210—FIG. 25 a Scavenger 4220—FIG. 18 a VMC SwitchManager 4230—FIG. 26 a Swapper Manager 4240—FIGS. 19, 20, 21 an SDPExternal Secure Storage Manager 4250—FIGS. 20, 21 and an SDP AbortHandler 4260.

These blocks or modules are implemented as coded physicalrepresentations on any system element or storage medium in FIGS. 1 and 2or elsewhere herein, and such as external flash memory 1025, on-chipnon-volatile memory such as RAM 1032 and internal flash or EEPROM 1036,and on web sites 1055 and 1065, PC 1070, and optical disk, CD_ROM, harddrive, diskette or otherwise as needed to deliver SDP 4200. The codedphysical representations are magnetically, electrically, optically, orotherwise-detectable physical variations or structures now known orhereafter devised that can represent the SDP 4200 and make SDP 4200available for execution.

In FIG. 17, upon completion of a latest set of SDP operations byStrategic Resolver 4210, operations Return to Secure Kernel at a step4270. SDP Strategic Resolver 4210 in FIG. 17 operates for example by 1)initializing the Backing Store of FIG. 12 by operations of FIG. 24, 2)storing securely in FIG. 21 the contents of a PHYS_SEC_PG from SecureRAM of FIG. 11 to External memory as a PG_SLOT to SDRAM_PG of FIG. 12,and 3) loading securely in FIG. 20 a PG_SLOT from External memory ofFIG. 12 to a PHYS_SEC_PG in Secure RAM of FIG. 11.

In FIG. 17, Secure Kernel components utilize an API 4205 to Call SDP4200 and initiate and/or request functions by Strategic Resolver 4210.SDP 4200 supplies an exported interface accessible to SDP_API 4205.Strategic Resolver 4210 acts as a central controller and includesInitialization Functions and Operational Functions. InitializationFunctions manifest and instantiate configuration information such asSDP_CFG of FIG. 11. This configuration information is provided by anauthorized provider such an OEM (Original Equipment Manufacturer) andretrieved securely during a secure boot sequence, such as in FIGS.22-23.

Operational Functions are powerful and kept few in number to reduce thecomplexity presented to the rest of the system. The OperationalFunctions interface provides a service to create a secure processaddress space and activate or deactivate it. These Operational Functionsallow the Strategic Resolver 4210 (and Secure Kernel as may beappropriate for its purposes) to easily switch between processes byunmapping a process, and mapping another process.

In FIG. 17, SDP 4200 readily accommodates processor power managementfunctions such as deep sleep. In a transition to deep sleep, anOperational Function unmaps all processes and flushes all pages fromSecure RAM to the DRAM-SWAP.

One or more External APIs (applications processing interfaces) that maycall SDP 4200 are collectively referred to as SDP_API 4205 herein. TheSDP_API is called for specific different reasons at runtime. Forinstance, on a MMU PG fault, SDP_API is suitably called and operationsbranch to Abort Handler 4260 to fill an empty, available or wipeablePHYS_SEC_PG.

SDP_API 4205 provides access by Secure Kernel to Strategic Resolver 4210and SDP-associated Operational Functions including: 1) Initialize fullSDP Environment (FIGS. 22-24), 2) Start a new VMC (FIG. 25), 3) Switchto a different VMC (FIG. 26), 4) Lock/Release a PG_SLOT (make a PG_SLOTirremovable from the Secure RAM)(FIG. 25), 5) Indicate Page Type as Dataand Code are loaded, and 6) Close a VMC (FIG. 26), and for a specificVMC, Swap Out all modified pages from Secure RAM.

In response to Call 4205 from Secure Kernel to SDP 4200, StrategicResolver 4210 acts as a central dispatcher and secure supervisor for SDP4200. Strategic Resolver 4210 is detailed further in FIG. 25 anddispatches functionality to respond to and handle particular events suchas service calls from other parts of the system for control of SDPoperations. Strategic Resolver 4210 in FIG. 17 dispatches and respondsto an SDP Fault Handler 4260 that in some embodiments includes orutilizes a high speed Dis-assembler 4280. Strategic Resolver 4210operates or dispatches a Scavenger 4220, a VMC Switch Manager 4230, anda Swapper Manager 4240 with SDP External Storage Manager 4250. StrategicResolver 4210 identifies unresolved or unresolvable faults by SDPUnresolved Fault operations 4255. Strategic Resolver 4210 performs ordispatches Instruction Requene operations 4265. Operations 4255 and 4265are followed by a Return to Secure Kernel 4270.

Scavenger 4220 process and/or hardware identifies a page in VMC VAS thatis not likely to fault again until a significant length of time in thefuture. Scavenger 4220 uses statistics to ascertain this information,and using a superior prediction hardware and procedure for high averageperformance. One category of embodiments of Scavenger 4220 finds theleast-used physical secure page PHYS_SEC_PG and sets or marks the pageslot then occupied by that page as a wiped (evicted or victim) slot.

Scavenger 4220 is largely implemented in hardware or largely insoftware, or some mixture of the two depending on embodiment, asdescribed in detail elsewhere herein and in U.S. non-provisional patentapplication TI-39617 “Page Processing Circuits, Devices, Methods AndSystems For Secure Demand Paging And Other Operations” U.S. Ser. No.______, which is hereby incorporated herein by reference.

In FIG. 17, the Scavenger 4220 is coupled by paths to call VMC SwitchManager 4230 and/or call Swapper Manager 4240. The VMC Switch Manager4230, upon request, switches the VMC used in the Secure Environment, VMCSwitch Manager 4230 is coupled by a path to call Swapper Manager 4240.The Swapper Manager 4240 swaps in and swaps out PHYS_SEC_PG in and outof Secure RAM as indicated by a bidirectional path between SwapperManager 4240 and SDP External Storage Manager 4250. The SDP ExternalSecure Storage Manager 4250 executes security aspects of the SDP thatoccur during Swap In/Swap Out.

SDP Abort Handler 4260 is coupled to an Exception Handler(s) (not shown)that is provided in the larger system environment of FIG. 3 and is in amodule external from SDP 2040 of FIG. 3 (and SDP 4200 of FIG. 17). Suchan Exception Handler intercepts a Secure Environment prefetch abort orSecure Environment data abort and, if the abort is an acceptable pagefault signal, quickly calls and passes control to the SDP Abort Handler4260. The Exception Handler determines acceptable page fault by somesystem integrity checks to verify that the abort is truly an acceptablePG Fault signal. Otherwise, if Exception Handler determines that thisabort is not a properly generated PG-FAULT signal, Exception Handlerdoes not call SDP 4200 and instead takes appropriate evasive orresponsive action without involving SDP 4200.

The Secure Kernel SK also has abort handler operations (not shown) thatback up critical information items that are later used to restore theprocessor 1030 state to the state before the PG Fault occurred asindicated by the address of the faulting instruction in an instructionfault address register, type of Abort and other information in aninstruction fault status register, and any PA registers that might bemodified by usage of those registers by the kernels. General purposeregisters are backed-up or pushed to an Abort or Supervisor stack of allregister file registers from the process. A Stack Frame Pointer (SFP) tothese registers on that stack of FIG. 10 is passed to the StrategicResolver 4210 along with any other pertinent information related to thePG-FAULT. Pertinent information items are passed for processing to, andupdate by, the SDP Abort Handler 4260 through an SDP_FAULT datastructure such as tabulated in TABLE 8.

In FIG. 17 and FIG. 10, the SEW Abort Handler 4260 passes the faultingpage address, and type of abort, and pointer to an apps stack frame onthe stack. SDP in a more complex embodiment has a high speeddis-assembler 4280 that accesses any registers of the application todetect whether a Load or Store instruction crosses a page boundary.

SDP Prefetch Abort Handler 4264 in a process example thereupon executesthese operations:

1) Reading an instruction fault address register to obtain the addressof the faulting instruction,2) Verification that the instruction address of the aborted instructionindeed matches or otherwise refers to the same address as from theinstruction fault address register.3) Verification that a CPU mode bit indicates that the fault occurredonly in a user mode. One type of processor 1030 suitably has mode bitsindicating user, fast interrupt processing, interrupt processing, andsupervisor.4) If all of the above items pass integrity checks, an SDP_FAULTstructure is instantiated as in TABLE 8 and added to a fault queue FIFO.5) Also, an SDP_FAULT_flags field has a specific flag set to indicatethat the fault is properly targeted for SDP resolution. A Prefetch Abortflag is set to indicate that the fault is occurring due to a prefetchabort.6) If a failure on any above item occurs, another flag inSDP_FAULT_flags field is set to indicate the type of failure. Enoughflags are provided for full identification of any fault status.7) A branch occurs to the Strategic Resolver 4210.

In TABLE 4, the data structure SDP_CFG is configured fir demand pagingof Code pages only, Data pages only, or both Code and Data pages. DataAbort Handler 4268 handles Data Aborts that are generated by theprocessor 1030. Where SDP_CFG is configured only for demand paging ofcode, or in an SDP embodiment omitting Data Aborts, then Data Aborts arenot utilized. Note, however, that setting the SDP_CFG configuration onlyfor demand paging of Code may actually reduce Code paging performancebecause Secure RAM pages become statically occupied with Data pages,leaving fewer pages in Secure RAM for Code paging. Accordingly, SDP_CFGis configurable for demand paging of Data as well.

An SDP_CFG configuration for both Code and Data allows for large Dataand Code VMC space. Configuring for both Code and Data also allows Datapage(s) to persist and remain between calls into a given PA or differentPAs sharing one or more pages in circumstances wherein multiple VMCs areconfigured. If a partial SDP configuration (with Code only demand paged)is configured with multiple VMCs, the SE kernel may need to unload thedata for each secure process, reducing the overall load, at anyparticular time, on the Secure RAM. On such partial SDP configuration, asufficient number of Secure RAM pages are provided to avoid impeding theSEW operations with Data pages statically occupying Secure RAM.

For systems configured with full SDP (Data and Code paging), anException Handler of the Secure Kernel swiftly passes a Data Abort tothe SDP Data Abort Handler 4268 and similarly passes a Prefetch Abort tothe SDP Prefetch Abort Handler 4264 as described above.

In FIG. 17, Data Abort Handler 4268 has process steps as listed next,for an example:

1) Reading a data fault address register to obtain the faulting addressof the data access associated with the Data Abort. Data fault addressmeans the address to which access was attempted, not the hereinbelowstep 3 instruction address of the instruction that caused the DataAbort.2) Inserting the data fault address into the SDP_FAULT structure ofTABLE 8 in a SDP_FAULT_DFA variable.3) Reading an instruction fault address register to obtain theinstruction address of the instruction that attempted access and causedthe Data Abort (fault).4) Inserting the instruction fault address read in step 3 into theSDP_FAULT structure of TABLE 8 in a variable SDP_FAULT_IFA.5) Setting a flag bit in SDP_FAULT_Flags indicating that a qualifyingSDP Data fault has occurred.6) Calling high speed Dis-Assembler 4280 to analyze the SDP_FAULT[0] (inan array of suitably three elements) to ascertain whether another faultwill be incurred by the same instruction before the instruction hascompleted its operation.

High speed Dis-assembler 4280 is used for Data Aborts. Because aparticular instruction might result in two pages needing to be swappedinto virtual memory, for performance reasons it is better to go aheadand resolve the next fault that a multi-fault instruction will incur.

Multi-fault instruction examples are the Load Multiple or Store Multipleinstruction, which cause multiple addresses to be loaded into registersdefining page accesses. These addresses can cross page boundaries,potentially causing the same instruction to fault multiple times. Fixingthe faults one at a time, and waiting until the next fault occurs, isfeasible; however, handling multiple faults from the first faultgenerated enhances the performance by reducing the page fault and decodeoverhead.

Thus, Load Multiple and Store Multiple instructions can potentiallycross a 4K page boundary causing not one, but two or even three or morepage faults depending on the instruction set architecture. The highspeed Dis-Assembler 4280 builds SDP_FAULT[1] and, if necessary, aSDP_FAULT[2], and so on. High speed Dis-assembler 4280 also sets a faultresolution count in an SDP_FaultCount variable, for use upon a Return toSDP Data Abort Handler 4268 to handle such additional faults. The faultresolution count bits are suitably included in part of the InstructionFault Status field of TABLE 8.

For each VMC, an SDP_FAULT structure of TABLE 8 is instantiated andadded to a Fault queue. In a more complex embodiment of SDP, the Faultqueue is a FIFO in which multiple fault descriptors SDP_FAULT[i] arequeued. Strategic Resolver 4210 then handles or services the Fault queueFIFO until the FIFO is empty. In a type of less-complex embodiment noqueue is needed and an SDP_FAULT item is generated when a Page Faultoccurs, whereupon Strategic Resolver 4210 handles the SDP_FAULT item.Another less-complex embodiment suitably structures even a singleSDP_FAULT item as a queue to provide architectural headroom for upgradeto a more complex embodiment as above. In such less-complex embodimentof SDP, the queue depth accommodates one SDP_FAULT item, and one PageFault at a time is thus queued and emptied by handling operations ofStrategic Resolver 4210.

TABLE 8 SDP_FAULT STRUCTURE SDP_FAULT[i] Field Size in Bytes Description_Abort_Type 1 Prefetch Abort or Data Abort _IFA 4 Instruction FaultAddress _IFS 4 Instruction Fault Status _DFA 4 Data Fault Address _SFP 4Stack Frame Pointer

In FIG. 17, an Instruction Requeue 4265 operation occurs when thefault(s) SDP_FAULT[i] have been handled. Then the page-faultinginstruction is set up to re-execute, this time without causing the faultsince the fault has been resolved by SDP 4200. Stacks and/or registersare modified for the process which faulted. The Exception Handler ofSecure Kernel is called at step 4270, and Exception Handler causes anactual return to the faulting process.

In the less-complex version of SDP for multiple page faultinginstructions, a Load Multiple or Store Multiple instruction might crossa page boundary and cause two page faults. SDP handles the first faultsingly, and then performs the instruction restart. The second fault ishandled after the instruction is restarted. When resolving the secondfault, the Scavenger 4220 does not wipe the page in Secure RAM that justreceived a Swap In to resolve the first fault. Scavenger 4220 internallyremembers which page is the last PHYS_SEC_PG that has been swapped intoSecure RAM by the Swapper Manager 4240, to prevent Scavenger 4220 fromremoving that last page. Thus, an endless loop scenario is preventedwherein Scavenger 4220 might otherwise thrash between pages that are thesubject of page faults by the same instruction.

If the page fault(s) cannot be resolved by Strategic Resolver 4210 andScavenger 4220, then Instruction Requeue 4255 operations are bypassedand an Unresolved Fault Handler 4255 is utilized by Strategic Resolver4210. Unresolved Fault Handler 4255 passes fully decoded faultinformation on to the Secure Kernel for handling. The fault informationdetails any unresolved fault(s) and/or passes a return error value on tothe Secure Kernel in a format recognized by the kernel as identifyingunresolved fault(s). The Secure Kernel executes its policy for that typeof fault, such as taking evasive action according to the policy for thattype of fault, which can include resetting the system.

As noted above, for handling a multiple-faulting instruction, a morecomplex embodiment of SDP 4200 includes a high speed Dis-assembler 4280associated with Strategic Resolver 4210. Suppose a Load Multipleinstruction caused multiple addresses to be loaded into the registers,and these addresses cross Page boundaries and cause the same instructionto fault multiple times. The less-complex embodiment resolves the pagefaults one at a time. The more-complex embodiment handles the multiplefaults in response to the first fault generated, and thereby enhancesprocessing performance by reducing Page Fault and decode overhead. Notethat the processor is likely to have few instructions like aload-multiple or store-multiple that can cause multiple page aborts. Itwould be undesirable to have a situation occur of first swapping in thesecond page to address a page fault of such an instruction and thenimmediately replacing that just-swapped-in second page with theadditional page because this would still not satisfy the needs of suchan instruction. Accordingly, swapper manager of some embodiments swapsin the additional page to both prevent the additional page fault, andthe SDP concurrently operates to prevent page replacement of the secondpage by the additional page. Also, it is possible to include in SDPgroups of simpler instructions as substitutes for each suchmultiple-operand original instruction, but modifying them over theoriginal page fault encountered instructions, such that they“re-execute” or instead-execute for the client (PA) only “portions” ofthe original instruction, that is, as if SDP were executing an imminentmultiply-faulting instruction in portions. The same approach can be donewith modifying the instructions of the client, but restoration tooriginal form would be employed to maintain code integrity of the client(PA).

In FIG. 17, an example of Dis-assembler 4280 creates a plurality ofSDP_FAULT[i] elements. A first SDP Fault element called SDP_FAULT[0] andthe registers pertaining to the given PA (on the stack of FIG. 10 in astack frame) are used to ascertain whether another page fault will beincurred by the same instruction before the instruction has completedits operation. Depending on the Instruction Set Architecture (ISA) ofthe processor, the largest number of page faults that one instructioncan cause is used to establish the number of SDP Fault elements in theembodiment. Dis-assembler 4280 builds a second SDP fault elementSDP_FAULT[1] when necessary, and any further SDP fault elements (e.g.SDP_FAULT[2], etc.) as needed.

In FIG. 17, if a new VMC is needed but is not yet loaded, StrategicResolver 4210 calls VMC Switch Manager 4230, as detailed in FIGS. 25 and26 later hereinbelow. The VMC Switch Manager module 4230 switches from acurrent VMC to a new VMC as shown in FIG. 17 and detailed in FIG. 26.VMC Switch Manager 4230 requests a new VMC Index through an APIdesignated SDP_VMC_GET_NEW( ) API. VMC Switch Manager 4230 invalidatesall SDP MMU entries for the current VMC, and can unlock locked physicalpage(s) PHYS_SEC_PG of the current VMC. But note that in FIG. 25, alocked PG of a current VMC is appropriately locked, such as formessage-passing, even as a new VMC is next dispatched.

If the new VMC has never been activated, VMC Switch Manager 4230activates the new VMC through an API designated SDP_VMC_ACTIVATE. ThisAPI provides any required configurations for the PA that is to be loadedas the new VMC. Also, VMC Switch Manager 4230 rebuilds the MMU Tablesfor the new VMC based in a VMC_PA2VA array. VMC Switch Manager 4230further resets and initializes secure registers used by Scavenger 4220in FIG. 18 and incorporated patent application TI-39617, Ser. No.______, to administer Secure RAM for the new VMC. Such secure registersinclude SDP_PAGE_TYPE (Code/Data) register, Dirty Page WR Register,statistics register STAT, page activation register ACT, and page wipingadvisor register ADV.

Switching from the current VMC[i] to a new VMC[i] can feasibly generatea call by VMC Switch Manager 4230 to the Swapper Manager 4240 for a SwapIn or Swap Out. In a process alternative, operations are returned by VMCSwitch Manager 4230 to the Strategic Resolver 4210 and the Swaps aredelayed until determined they are absolutely necessary via PG-FAULTSoccurring in the new VMC as provided by the Abort Handler 4260. Someembodiments separate the VMC Switch Manager 4230 in the process relativeto the Swapper Manager 4240 and can reduce the number of Swap In andSwap Out operations when switching from a current VMC to a new VMC.

Turning to FIG. 18, an example of the Scavenger 4220 of FIG. 17 has aprocess 4300 in FIG. 18 that finds an available PG (page) by looking foran empty PHYS_SEC_,PG such as by looking at the 16 upper address bits inthe VMC_PA2VA array variously designated VMC_PA2VA 2120 of FIG. 4, SEPage Tables 2850 of FIGS. 9A-9E, and VMC_PA2VA in the SDP_VMC_CFG area3150 of FIG. 11. If there is no empty page, then Scavenger 4300 finds abest page for wiping so that a new page can be Swapped In to resolve thePage Fault. This search process is handled in software or hardwareaccording to various embodiments such as shown in FIG. 18 and inincorporated patent application TI-39617, Ser. No. ______.

Some embodiments use statistics hardware or software and a specialprioritizing procedure for prioritizing Data pages and Code pages asDirty (modified) or Clean (unmodified) to determine the next best PG towipe (free up) and then Swap In a PG_SLOT from SDRAM into thatPHYS_SEC_PG in Secure RAM to resolve the current PG-FAULT. Suppose thePHYS_SEC_PG is found for wiping, but that page is dirty. Then a Swap Outoperation is executed to keep SDRAM up-to-date with the dirty page. Thenthe new page is Swapped In to resolve the Page Fault. If the Statisticshardware module is not able to find a PG to wipe, Scavenger 4300 choosesPHYS_SEC_PG at random.

Prior to any process in this Scavenger 4300, a first check is performedto see if the PG_SLOT is already loaded in Secure RAM from a previousVMC switch. The VMC_PA2VA array in the SDP_VMC_CFG Structure 3150 (FIG.11 and TABLE 5) indicates for the current VMC if a PHYS_SEC_PG isalready linked to the requested PG_SLOT. This array is parsed to obtainthe information. If the PHYS_SEC_PG is found, then the Scavenger 4300module simply updates the MMU descriptor which links the VA (virtualaddress) of the requested PG_SLOT to the PHYS_SEC_PG just found inSecure RAM 1034.

In FIG. 18, operations of Scavenger 4300 begin with a Call 4305 to theScavenger to load a virtual address index1 VA1, and then a step 4310identifies the Type (Data or Code) of the request pertaining to a pagePHYS_SEC_PG.

Next, a decision step 4320 determines if the particular requestedvirtual page slot PG_SLOT in fact has a PHYS_SEC_PG assigned to PG_SLOTin the table designated VMC-VA2PA. If the physical page is alreadyassigned to the virtual page, and thus the page to which access isneeded is already present (Yes), then operations update the MMUDescriptor and end or return from the Scavenger at a step 4325. If thepage slot is not present (No), then operations go from decision step4320 to a second decision step 4330 to determine whether an empty pagePHYS_SEC_PG is available in Secure RAM, such as indicated in theActivity register ACT. If not, operations branch to a scavenging step4340. If so (Yes), then operations go directly to step 4390, callSwapper Manager 4240, and perform a Swap In of the page.

One example of page-specific bits fr register ACT operates as follows.Register ACT in the hardware has one bit per physical page to identifywhether the page is active in the sense of being subject, or not, tooperations of the hardware page wiping advisor in incorporated patentapplication TI-39617. The page wiping advisor operations discussed inconnection with FIG. 18 identify according to current page usagestatistics (on pages having ACT=1) the highest priority page for wiping.Software is used to distinguish an Empty page from a Locked page. Whenan application has just finished or is replaced by another one(multi-threading invokes an SDP Application secure scheduler, seeStrategic resolver 4210 and VMC switcher 4230), all pages are suitablyentirely wiped-out.

A physical page is activated by setting ACT[N]=1 in this example, inorder to be taken into account by the page wiping advisor. When thephysical page activated, the hardware statistics mechanism generatesstatistics STAT[N] on each such activated page. When a page is notactivated (ACT[N]=0), such not-activated page is nonexistent to, orbeyond or outside of, the hardware page wiping advisor mechanism. Evenif a page is activated (ACT=1), this page can be wiped out (e.g., byflush 4365) even if the hardware page wiping advisor says otherwise,since the page wiping advisor monitors functional buses in anon-intrusive manner.

A physical page marked as not activated (ACT[N]=0) might be Empty ornon-empty, and Locked or not locked. The not-activate state simply meansthat the physical page N is not taken into account by the page wipingadvisor mechanism.

During loading or filling of a physical page N in Secure RAM by DMA,such as in case of an empty page, operations also set ACT[N] to zero (0)or momentarily keep ACT[N] in that not-active state. Then when the pageN is loaded and ready to be used, ACT[N] is set to one (1) for thatpage, enabling the page wiping advisor to compute statistics on thatpage N. When the loading is done, the empty page thus becomes a wipeablepage-in-use.

A Locked page is one instance of a page that has ACT[N]=0 and is used bythe SDP 4200. Such page is not taken into account by the page wipingadvisor and accordingly is not identified for wiping out. The Lockedpage is used by SDP as described elsewhere herein. Code executing from apage-in-use can branch to or jump onto a Locked page. The SDP PPACode/Data physical pages 3120 of FIG. 11 are suitably also maintained asLocked pages and with any further protections as appropriate to maintaintheir operations intact regardless of VMC switching for instance.

Another embodiment providing a second example of ACT registerPage-specific bits is tabulated in TABLE 9.

The ACT Page Activation Register is set to one for wipeable pages and tozero for not-wipeable pages. A page-in-use is wipeable but needs theWiping Advisor information to be wiped. An empty page is wipeablewithout the Wiping Advisor information and is simply loaded until thepage space is full, and the Wiping Advisor comes into play after allpage space is full. A locked page is not wipeable. Since an empty page,a wipeable page-in-use, and a locked page are treated differently, twobits per page in the ACT register are used to keep track of thesestatuses in this embodiment.

TABLE 9 ACT REGISTER PAGE-SPECIFIC BITS 00 Reset state of ACT register,page information unspecified 01 Empty Physical Page in Secure RAM 10Occupied Physical Page (Loaded page; subject to page wiping advisor.) 11Locked Physical Page

The ACT register in some embodiments has two page-specific bitsindicating whether that PHYS_SEC_PG is Empty (01), Loaded (10) or Locked(11) to support step 4330 of FIG. 18. For instance, the ACT PageActivation Register has the page-specific bits set to 10 (one, zero) foreach wipeable page and to 11 (one, one) for a Locked (not-wipeable)page. An occupied page or page-in-use is wipeable and uses scavenging4340 to determine whether it is to be wiped.

Initialization of the ACT register sets the bits to “01” (zero, one) foreach Empty page. The Empty page code 01 is detected at step 4330 so thatthe Empty page can be filled (Swapped In to) without need of scavengingstep 4340. Operations go from step 4330 to step 4390 to Swap In a pagePG_SLOT to the empty page PHYS_SEC_PAGE. Empty pages are filled untilthe physical page space is full, and the scavenging 4340 comes into playif all page space is full and thus no Empty pages are present. A lockedpage is not wipeable, it is prevented from being wiped. Since an emptypage, a wipeable page-in-use, and a locked page are all treateddifferently, two or more bits per page are used in the ACT register orthe information is distributed elsewhere in hardware or software (e.g.,PA2VA of FIG. 11 and TABLE 5) as suitable to keep track of thesePage-specific statuses.

Step 4340 processes and decides on the best page to wipe, such as by theprocedure illustrated in FIG. 28 or otherwise as described in thisdisclosure and including incorporated patent application TI-39617. TheStep 4340 process identifies the best physical page PHYS_SEC_PG index(indexp) and virtual page slot index (PG_SLOT indexv) for the requestedtype (Data or Code) and puts the page identification in the wipingadvisor secure register ADV. If step 4340 determines a single result,then operations go to a decision step 4360. If step 4340 determinesmultiple results or no result, then operation goes to a step 4350 andrandomly selects a page PHYS_SEC_PG, and then goes to the decision step4360.

Some further embodiments for use with the process of Scavenger Manager4300 are also detailed in U.S. non-provisional patent applicationTI-39617 “Page Processing Circuits, Devices, Methods And Systems ForSecure Demand Paging And Other Operations” U.S. Ser. No. ______, whichis hereby incorporated herein by reference.

Decision step 4360 determines if any of the following conditions arepresent: 1) Secure RAM physical page PHYS_SEC_PG indexp is Locked, 2)that physical page is not equal to the requested Type (Data/Code), or 3)the physical page PHYS_SEC_PG to be wiped to accommodate requestedVirtual page Pq_SLOT indexv is the same as the physical page PHYS_SEC_PGinto which the last Swapped-In virtual PG_SLOT index v was supplied.

The foregoing first condition (1) means the page is unavailable becauseit is locked. The second condition (2) means that the step 4340 isreturning a non-requested Type of page for wiping in embodiments whereinnumerical allocations of Secure RAM pages to Code or Data types areinvolved, or SDP configuration information includes a particular pagetype in the operation or not. The third condition (3) preventsthrashing, such as on multiple-faulting instructions like Load Multipleand other scenarios. Step 4360 thus checks for page characteristicsunsuitable for wiping and if any such characteristic is present, thenbranches to identify another page to wipe.

If any of the above conditions pertain (Yes) in decision step 4360, thenoperations go back to step 4340 and select another page next lower inpriority that satisfies the conditions and/or go to step 4350 torandomly select an equally-satisfactory page other than the page whichtriggered the Yes determination in decision step 4360. Detectionoperations pertaining to SDP Unresolved Fault 4255 in FIG. 17 determineif an endless or very long loop 43604340 is occurring in FIG. 18, orthat the foregoing or other unresolved fault conditions are present,whereupon an Unresolved Fault flag is set and operations 4270 return toSecure Kernel.

Some embodiments integrate the tests of step 4360 into the step 4340 sothat loops are obviated. For example, software or hardware logicexcludes and prevents any Locked, wrong Type page and Last Swapped Inpage from being in the physical pages that are scavenged.

In FIG. 18, if none of the above conditions pertain (No) in decisionstep 4360, then operations go to a further decision step 4370. Step 4370determines if either of the following conditions pertains: 1) physicalpage PHYS_SEC_PG_indexp is unmodified (not-Dirty) as indicated by secureregister WR, or 2) that the virtual page slot PG_SLOT is empty. Ifneither condition pertains (No=Dirty and Not-Empty) in step 4370, thenoperations go to a step 4380 to execute the Swapper Manager 4240 of FIG.17 to perform a Swap Out of the current page to be evicted from SecureRAM.

In FIG. 18, operations that use step 4380 go from step 4380 on to a step4390 to call the Swapper Manager 4240 to execute the desired Swap In ofa new page to resolve the Page Fault originally reported by AbortHandler 4260 so the PA can proceed. In decision step 4370, if eithercondition pertains (Yes=Not Dirty or Slot Empty), then operations bypassSwap Out 4380 and go directly from step 4370 to step 4390 to executeSwapper Manager 4240 to perform the desired Swap In of a new page neededfor further executing the PA.

Step 4390 is also responsive to a No Swap In Flag (NSI Flag) withselective operation so that Swap In operation is disabled or bypassedwhen NSI is active (No Swap In). Swap In operation is enabled and calledwhen NSI is inactive (Swap In=not No Swap In). The NSI flag is usefulfor supporting embodiments with a pro-active page wiping cycle executedin a processor 1030 lower-use period as described in connection withFIG. 25.

Upon completion or bypassing of Swap In step 4390, the Scavenger hascompleted its operations and suitably has a RETURN to return control toStrategic Resolver 4210 of FIGS. 17 and 25.

When a page Swap is occurring due to either a page fault usually orprecharging (e.g., runtime initialization of FIG. 24) on entry to secureenvironment, some processing with the RISC processor is suitablyperformed while the DMA unit is operating the cryptographic acceleratorand process. Efficient scavenging process includes the steps of 1) StartSwap Out operation so that the DMA 2410 of FIGS. 7-8 drives for a while.2) While DMA is doing crypt operation, use the RISC processor 2425 forscavenging again per 3A. 3A) Use Scavenger 4220 with NSI active to findthe next best free page and Swap Out proactively. Alternative to 3A is3B, 3B) Some embodiments provide an NSO (No Swap Out) bit active andenter a next page identification on a Next Page to Swap Out list orqueue NPSO. This defers the Swap Out operation. The page wiping advisorof Scavenger 4220 is further used to selectively find the next-best pagefor wiping and add it to the NPSO queue as well. The Swap Out isscheduled by parallelizing it with another operation later and/or byperforming the Swap Out in a processor lower-activity time period orinterval.

In FIG. 19, the Swapper Manager module 4400 shows one example of aprocess and structure for the FIG. 17 Swapper Manager 4240. SwapperManager module 4400 handles Swap in of PG_SLOTS from SDRAM to physicalpages PHYS_SEC_PG of Secure RAM, and also handles Swap Out of physicalpages PHYS_SEC_PG from Secure RAM to PG_SLOTs in SDRAM.

In FIG. 19, operations commence with a Call 4405 to the Swapper Manager4400 to either Swap In a virtual page identified by indexv1, or Swap Outa virtual page identified by indexv2 (PA2VA identities the correspondingphysical page indexp2 and vice-versa). A Swap Out operation into SDRAMis performed if the PHYS_SEC_PG is considered as dirty (modified).Accordingly, a decision step 4410 determines whether PHYS_SEC_PG isdirty. Page-specific Dirty Bits are provided by the secure WR Registerand Dirty indicates that a write access has been performed to thisPHYS_SEQ_PG. If Dirty, operations go to a Swap Out block 4420 to performthe Swap Out by calling the SDP External Secure Storage Manager 4250 toperform secure storage into SDRAM for page PG_SLOT indexv2.

Operations proceed from Swap Out 4420 to a step 4430. Also, if decisionstep 4410 determines no Swap Out is required (unmodified page), thenoperations proceed directly to step 4430, bypassing step 4420. Step 4430cleans MMU table descriptor(s) for the related PG_SLOT by invalidating aMMU second level descriptor for the virtual address indexv2. In thisway, PHYS_SEC_PG in Secure RAM has been wiped by Scavenger and alsobecomes an Invalid 4K PG as seen by MMU. The VMC_PA2VA array is thuscorrespondingly cleared to update the Secure RAM contents mapping ofvirtual pages to physical pages.

Preparatory to Swapping In a virtual page PG_SLOT indexv1, step 4430updates the MMU second level descriptor for the requested virtualaddress indexv1 in the MMU Tables. In the SDP_VMC_CFG Structure 3150,the VMC_PA2VA array in one type of embodiment maps 256 PHYS_SEC_PGstatus (empty=0/loaded=1) of the VMC. See TABLE 5 for another type ofembodiment that either also or instead maps sixteen PHYS_SEC_PG ofSecure RAM to any currently-resident virtual PG_SLOTs. Step 4430 alsoinitializes the Secure registers page TYPE (Code/Data) register, DirtyPage WR Register, statistics register STAT, page activation register ACTto Empty, and page wiping advisor register ADV.

Next in a step 4440, the NSI Flag is checked. If No Swap In (NSI) isactive, then operations go to RETURN 4460 immediately. Otherwise, ifSwap In is permitted by the NSI Flag and PG_SLOT is already securelystored in SDRAM, the Swapper Manager module step 4440 calls the SDPExternal Secure Storage Manager 4250 to Swap In this PG_SLOT from SDRAMto the wiped PHYS_SEC_PG in Secure RAM. When PG_SLOT Swap In operationis completed, operations go to a step 4450.

Step 4450 updates the VMC_PA2VA array in the VMC_CFG Structure 3150 ofFIG. 11 (see also FIG. 4) to identify the correspondence between virtualaddress indexv2 for the new PG_SLOT that is Swapped In to a givenPHYS_SEC_PG having physical indexp2. Step 4450 also updates the Secureregisters page TYPE (Code/Data) register, Dirty Page WR Register,statistics register STAT, page activation register ACT, and page wipingadvisor register ADV.

Then a RETURN 4460 exits the Swapper Manager module 4400. SwapperManager module 4400 provides a Return value as follows:

PG_SLOT_SWAP_IN: Swap has been performed correctly.PG_SLOT_EMPTY: Indicates to the Strategic Resolver 4210 that the Swap Inoperation has not been performed but the MMU 2nd level descriptor hasbeen set correctly,

An effective SDP Scavenger 4220 process obviates or minimizes thrashing.A sign of thrashing is that an unacceptably high amount of time isconsumed performing Swaps on the code being executed, compared to thetime occupied in actual code execution. Thrashing in a conventionalworkstation (wherein data is transferred between DRAM as primary storeand hard disk as secondary storage) prolongs applications noticeably andmakes a banging sound in hard disk operation. If DRAM thrashing were tooccur on a Swap file under SDP swaps between the DRAM and Secure RAM,noise would probably not occur but the PA protected application mightappear prolonged or locked. By using a library of PAs with functionsthat enter and exit, and by using an effective SDP Scavenger process astaught herein, SDP thrashing is avoided.

In FIGS. 20 and 21, the SDP External Secure Storage Manager 4250 moduleis described. The SDP data structure uses several cryptographicmechanisms to ensure its global security: 1) Integrity, to ensure thatdata imported and exported between SDRAM and Secure RAM have not beenunauthorizedly replaced or unauthorizedly modified, with the integritybeing ensured using hashing (e.g., SHA-1) and signing. 2) Authenticity,to ensure that data have been saved in SDRAM by the Secure Modeexecution by the chip, with authenticity ensured using dedicatedinternal Secure RAM which is only accessible within the SecureEnvironment of the chip (storing a fingerprint of the SDP data). 3)Confidentiality, to ensure that the data saved from Secure RAM to SDRAMare kept secret, with confidentiality ensured using encryptiontechniques (e.g., AES using CBC mode).

Furthermore, authenticity is ensured over time to prevent replay attack,meaning that actual data is not unauthorizedly replaced withauthenticated data stored before. An up-to-date hash value stored inSecure RAM is combined with pre-verification and post-verification ofdata integrity before and after exporting a SDP PG from Secure RAM toSDRAM.

FIG. 20 shows an example of a process 4800 for executing Swap Inutilized by SDP External Secure Storage Manager 4250 of FIG. 17 and forstep 4390 of FIG. 18 and/or step 4440 of FIG. 19 in the Secure Swapperof FIG. 4 and in the structures and processes of FIG. 5, FIG. 8, andFIGS. 9A-9E. Swap In Operational Function SDP_PG_SLOT_SWAP_IN Swaps In aPG_SLOT into Secure RAM.

Operations commence with a BEGIN 4805 of Swap In of a PG_SLOT (Load),including a check for valid parameters and if invalid, then an automaticerror and RETURN (not shown). Input arguments (parameters) include:

1) SDP_EXT_BK_SEC_STORAGE_ADDRESS: Address of the memory area for theSDP_EXT_BK_SEC_STORAGE structure of FIG. 12 in SDRAM.2) VMC_INDEX, the index of the VMC for which the PG Swap In isperformed.3) PG_SLOT_INDEX, the index of the PG, SLOT in the VMC.4) PHYS_SEC_PG which is Swapped in,5) PG_HASH. Hash value prestored in Secure RAM on during Bootinitialization of SDP or on the next-previous Swap Out. Should match aHash of the page when Swapped In.

If the parameters satisfy the validity check in step 4805, thenoperations proceed to a step 4810 that sets an index i equal to therequested VMC_(—) INDEX to access VMC[i], sets an index j tea accessBlock Book Keeping block BBK[j] within that VMC[i], and sets an index kto access Book Keeping space BK[k] within that BBK[j]. Book Keeping isdiscussed in connection with FIGS. 11, 12 and 13.

Next in FIG. 20, a decision step 4820 determines whether the j-indexedBBK[j] of the i-th indexed VMC[i] is already loaded into Secure RAM. Ifnot (No), BBK[j] is used and operations go to a step 4830.

Step 4830 updates the FIG. 11 data structure SDP_INT_SEQ_STORAGE inSecure RAM by sending it updated hashes from SDRAM for checking withcorresponding hashes already stored in Secure RAM. First, step 4830hashes the requested Nth one of the SDRAM Book Keeping spaces BK[k] ofthe Block Book Keeping area BBK[j] to update the BK[k] Hash 3230 inFIGS. 12 and 13. Step 4830 also updates the BBK_HASH[j] in SDRAM thatdepends on the updated BK[k] Hash 3230.

In this way, step 4830 updates the FIG. 12 structure External BackingSecure Storage SDP_EXT_BK_SEC_STORAGE and then exports the Nth BookKeeping space BK[k] of Block Book Keeping area BBK[j] from the SDRAM.This export operation provides Secure RAM with a a hash of Book Keepingarea BK[k], a BBK hash of j-th BBK[j] that depends on the hash of areaBK[k], a VMC hash of the current VMC[i] which depends on the BBK hash,and a final hash of SDP Structure comprised of all the VMCs. Variousembodiments provide and use one, some or all of these hashes, and alsovariously execute steps 4830 and 4840 conditioned upon step 4820 orunconditionally. Steps 4830 and 4840 are adapted to the embodimentselected to trade off between Secure RAM space and amount of processingas discussed elsewhere in connection with FIGS. 11 and 12 hereinabove.

Operations proceed to a step 4840 to further update the FIG. 11structure SDP_INT_SEC_STORAGE in Secure RAM by importing the hash ofBook Keeping area BK[k], the BBK hash of j-th BBK[j] that depends on thehash of area BK[k], the VMC hash of the current VMC[i] which depends onthe BBK hash, and the final hash of SDP Structure comprised of all theVMCs. See FIGS. 5, 11, 12, 13, 14, 15, 16. Step 4840 checks theintegrity of the imported hash(es) BK[k] Hash, BBK_HASH[j], VMC[i] Hashand SDP Hash from FIG. 12 SDRAM by comparing one, some or all of themwith the pre-stored Hash value(s) in Secure RAM in FIG. 11.

Operations go from decision step 4820 if Yes (BBK[j] already loaded)directly to a step 4850. Operations also go from step 4840, if executed,directly to step 4850. Step 4850 imports the requested Header k (FIG.13, FIG. 14) for the requested PG_SLOT into the correspondingSDRAM_PG_HEADER space in FIG. 11 structure SDP_(—) INT_SEC_STORAGE, andfurther imports the entire requested 4K page PG_SLOT k into thedestination physical page PHYS_SEC_PG in Secure RAM. At step 4850 aninternal page structure is initialized to have page contents includingdata of the k-th page k of the j-th BBK j of the i-th VMC I, and aheader including 4K byte aligned data1 field and a data2 field of FIG.13.

Next, a step 4860 processes the PG_SLOT Header for Integrity, if anIntegrity Flag is set. Step 4860 utilizes Integrity Check processes suchas either or both of the following. In a first Integrity Check process,step 4860 compares its Secure RAM-stored BK_Hash k, which was generatedon last Swap Out of the requested PG_SLOT, by comparing for equalitywith the value BK_HASH newly imported as part of the PG_SLOT Header ofthe requested PG_SLOT. In a second Integrity Check process, thenewly-imported 4K page PG_SLOT itself is hashed and the resulting hashvalue is compared for equality with BK_HASH_k from the PG_SLOT Header.In a third Integrity Check process, the newly-imported 4K page PG_SLOTitself is hashed and the resulting hash value is compared for equalitywith Secure RAM-stored BK_Hash k, which was generated on last Swap Outof the requested PG_SLOT.

Respective bits in a Verify variable are updated when these first,second, third, and any other Integrity Checks are passed or failed instep 4860. If any of the Integrity Checks are failed, then operationsbranch to appropriate response(s) to security violation, such as RETURNto Strategic Resolver 4210, reset, warning message, call to central callcenter and so forth.

Step 4860 suitably includes a call to a Hash function having argumentsPgNumDRAM and PgNumSRAM pertaining to the pertinent data structureelements and their locations.

A succeeding step 4870 decrypts PG_SLOT (data1) when directed to do soby a Confidentiality Flag set up for the PA or in the Systemconfiguration. Some embodiments double-hash by originally hashing theunencrypted page, combining the page with its hash, encrypting thecombined page, and then hashing the encrypted result. On Swap In of FIG.20, a reverse process is then performed. Step 4860 checks the hash ofthat encrypted combined page. Step 4870 decrypts and also checks therequested newly-decrypted page PG_SLOT for integrity using an IntegrityPattern (final motif comparison data2) when directed to do so by anIntegrity Flag. The Verify variable is accordingly updated depending onwhether the verification succeeded or failed.

Then a further step 4880 updates the structure VMC_CFG by settingvmc_index equal to i, bbk_index equal to j within the VMC, and bk_indexequal to k within the BBK. Integrity of the entire SDP data structureincluding SDP_INT_SEC_STORAGE of FIG. 11 is checked, and the Verifyvariable is further updated based on verification of any one, some orall of the BBK hash, VMC hash, SDP final hash, and SDP final hash versusSecure RAM final hash. Upon completion of step 4880, a step 4890 setsactive and returns a datum PG_SWAPPED_IN to represent that the requestedpage PG_SLOT is successfully Swapped In. Operations RETURN to StrategicResolver 4210 of FIG. 17 or otherwise as described in connection withFIGS. 18 and 19.

Description now turns to a Swap Out function as depicted in FIG. 21.Compared to FIG. 20, a Swap Out function SDP_PG_SLOT_SWAP_OUT converselySwaps Out a PG_SLOT from Secure RAM to SDRAM. In this way SDP ExternalSecure Storage Manager 4250 of FIG. 17 has a Swap Out function as wellas a Swap In function.

In FIG. 21, SDP External Secure Storage Manager 4250 of FIG. 17 executesa Swap Out process 4900 example for executing Swap Out for step 4380 ofFIG. 18, and/or step 4420 of FIG. 19 in the Secure Swapper of FIG. 4,and in the structures and processes of FIG. 6 and FIG. 7. ThisOperational Function SDP_PG_SLOT_SWAP_OUT saves a page from Secure RAMto DRAM. Operations commence with a BEGIN 4905 of Swap Out a PG_SLOT(Store), including a check for valid parameters and if invalid, then anautomatic error and RETURN (not shown).

Input parameters to this Operational Function include

-   1) SDP_EXT_BK_SEC_STORAGE_ADDRESS: Address of the memory area for    the SDP_EXT_BK_SEC_STORAGE structure of FIG. 12 in SDRAM.-   2) VMC_INDEX, the index of the VMC fear which the PG Swap Out is    performed,-   3) PG_SLOT_INDEX, the index of the PG_SLOT in the VMC.-   4) PHYS_SEC_PG, the physical page which is Swapped Out.    This Operational Function returns an internal hash value as well as    performing the Swap Out.

If the parameters are determined valid, in that they satisfy the checkin BEGIN 4905, then a step 4910 sets an index i equal to the requestedVMC_INDEX to access a requested VMC[i], sets an index j to access arequested BBK[j] within the VMC, and sets an index k to access arequested Book Keeping area BK[k] and page within the BBK[j]. BookKeeping is discussed in connection with FIGS. 11, 12 and 13.

Next in FIG. 21, a decision step 4920 determines whether the j-indexedBBK[j] of the i-th indexed VMC[i] is already loaded in. This step 4920(with steps 4930 and 4940) is used in embodiments that progressivelyload PAs from Flash via Secure RAM to SDRAM at run-time instead ofloading the whole PA from Flash via Secure RAM to SDRAM at Boot time asin FIG. 24. In the latter case operations simply go from step 4910 tostep 4950 in runtime Swap Out. With step 4920, if the determination isNot Already Loaded In (No), BBK[j] is used and operations go to a step4930.

Step 4930 updates the FIG. 11 structure SDP_INT_SEC_STORAGE in SecureRAM. Step 4930 hashes the N Book Keeping elements BK[k] of the BlockBook Keeping area BBK[j] and, now that new BK_HASH[k] data is on hand,proceeds to update the hash BBK_HASH[j] by hashing all sixteen hashesBK_HASH[k] in the Block Book Keeping area BBK[j]. Also step 4930 updatesthe FIG. 12 SDRAM data structure SDP_EXT_BK_SEC_STORAGE 3200B andexports and copies all N Book Keeping elements BK[k] of Block BookKeeping area BBK[j] from the Secure RAM of FIG. 11 to the correspondingrespective spaces in SDRAM of FIG. 12.

Operations proceed to a step 4940 to further update the FIG. 11structure SDP_INT_SEC_STORAGE in Secure RAM by importing all N BookKeeping spaces BK of Block. Book Keeping area BBK[j] from the SDRAM intothe Secure RAM. This import operation provides Secure RAM with a finalhash of the SDP data structure, a set of VMC hashes for each VMC, a setof BBK[j] hashes of any given VMC[i], and a set of N BK[k] hashescontained in the j-th BBK. Step 4940 checks the integrity of the BBK[j]imported hash BBK_HASH[j] from FIG. 12 SDRAM by comparing it with thepre-stored Hash value of FIG. 11 Secure RAM. Integrity of SDP datastructure SDP_INT_SEC_STORAGE of FIG. 11 is checked and the Verifyvariable is further updated based on verification of any one, some orall of the BBK hash, VMC hash, SDP final hash, and SDP final hash versusSecure RAM final hash. Steps 4930 and 4940 are adapted to the embodimentselected to trade off between Secure RAM space and amount of processingas discussed elsewhere in connection with FIGS. 11 and 12 hereinabove.

Operations go from decision step 4920 if Yes (BBK[j] already loaded)directly to a step 4950. Operations also go from step 4940, if executed,directly to step 4950. Step 4950 encrypts PG_SLOT k (data1) if aConfidentiality configuration flag indicates that encryption isrequested. Also, step 4950 sets PG_SLOT integrity using the integritypattern. Step 4950 sets the integrity of the internal page using thefinal motif (data2).

Next, a step 4960 processes the PG_SLOT Header. If an integrity flag isset, then step 4960 depending on embodiment 1) generates an InternalPage Data Hash k by hashing the PG_SLOT, or 2) separately generates anInternal Page Header Hash by hashing the PG_SLOT Header, or 3) hashesthe PG_SLOT and the header together, and/or 4) otherwise suitablyestablishes integrity. BK_HASH[k] for Book Keeping element BK[k] isprocessed by writing the new hash into BK_HASH[k] as labeled in FIG. 11Hash of Swap PG_SLOT Assoc. with BK. Integrity of the entire SDP datastructure SDP_INT_SEC_STORAGE of FIG. 11 is furthered by also storingany one, some or all of the BBK hash BBK_HASH[j], SDP_VMC_HASH[i], andfinal hash SDP_HASH of all VMC hashes.

A succeeding step 4970 exports the following from Secure RAM to SDRAM.1A) the updated Nth Book Keeping element BK[k] including hash BK_HASH[k]of j-th Block Book Keeping BBK[j], 1B) the updated jth hash BBK_HASH[j]of the i-th VMC[i], 1C) the updated i-th hash VMC_HASH[i] of VMC[i], 1D)the updated hash SDP_HASH of SDP structure over all VMCs, 2) PG_SLOTHeader k, 3) the whole internal page of PG_SLOT k to SDRAM_PG encryptedor not as an Encryption Flag directs, and 4) an Integrity Pattern(encrypted or not) related to this page PG_SLOT k. Step 4970 operatesfrom on-chip Secure Environment with processor and Secure RAM toorganize and generate the Page Header for transfer to SDRAM_PG_HEADER inFIG. 12 as described in connection with various embodiments such asthose of FIG. 12 and FIGS. 14, 15 and 16. Step 4970 thus stores andupdates the corresponding SDRAM areas of FIG. 12 to which thejust-stated fields from Secure RAM are exported.

For purposes of steps 4960 and 4970, a function call is suitably made toa function Encrypt4kPGWithHMAC_to_DRAM having arguments PgNumSRAM andPgNumDRAM. The operations are suitably supported in software by process1030, offloading to DSP 1110 and/or 1420 of FIG. 2 and/or to SecurityAccelerators 1140 and/or 1450.

Then in FIG. 21 a further step 4980 updates the structure VMC_CFG bysetting vmc_index equal to I, bbk_index equal to j within the VMC, andbk_index equal to k within the BBK. The structure SDP_VMC_CFG 3150 ofFIG. 11 is updated for instance at VMC_PA2VA to reflect wiping of thepage. Embodiments that also or instead use the inverse mapping ofPG_SLOT_FLAGS of TABLE 6 update that data structure PG_SLOT_FLAGS aswell, to reflect wiping of the page. Upon completion of step 4980, astep 4990 returns a datum PG_SWAPPED_OUT signaling Success that the pageis Swapped Out.

SDP Swap security is resistant to Replay Attack and Data ModificationAttack. Replay Attack attempts an unauthorized replacement of any partor parts of the data structure DRAM_PG_TRACK_ARRAY of FIG. 12, such asany one or more of page(s) PG_SLOT, a page header, an integrity elementin the hierarchical hashing structure, addresses, or backup tables. Inthe Replay Attack, an earlier-valid instance of any such part(s) isintercepted and copied back into the data structure to attack the securesystem. Data Modification Attack or Accident results from operations ofunauthorized code, or simply buggy or errant code, in the non-secureoperating environment taking control of a secure process at anon-privileged level in the Secure Environment. Some embodiments providean additional category of security so that the privileged PAs (PPAs) arestored and run inside the secure environment and are not transferredoff-chip to the DRAM. Both Replay Attack and Data Modification aredetected and prevented as described herein.

Replay attacks are also deterred in SDP by applying methods, processesand structures to SDP such as those described in TI-38214, U.S. Ser. No.11/100,690 filed Apr. 7, 2005, entitled “Methods, Apparatus, and Systemsfor Securing SIM (Subscriber Identity Module) Personalization and OtherData on a First Processor and Secure Communication of the SIM Data to aSecond Processor,” and hereby incorporated herein by reference.

In an additional security aspect, the SDP software checks what has beendefined in the Page TYPE register (CODE/DATA) and check that no writeaccesses occurred on CODE. This check ensures that no page has beenoverwritten locally in Secure RAM by a buffer overflow attack, DMAattack, or other security attack. This check is performed atnon-periodic frequent intervals, such as by Scavenger 4220 and/orStrategic Resolver 4210 and/or by any of the modules of FIG. 17.

Encryption Key Rotation is provided to prevent brute force decryptionattacks attempting to find patterns in encrypted structures, if any suchpatterns existed. Accordingly, encryption keys used for encrypting andhashing Swapped data are rotated to avoid occurrence of such patterns.

Partitioned Sequence ID with bits for Key Index component. The bottomtwo bits for four keys (or three bits for eight keys, etc.) of a 64 bitsequence ID (identification) are herein called a KSelector. Those bottombits are used as an index to select a next encryption key in an array ofkeys which are internally stored in secure storage. KSelector is used asan index for selecting the encryption key to be used for HMAC and TDES.KSelector is suitably used directly for indexing to the key for HMAC,and for extra security, the KSelector is XORed for inverting the indexto the TDES encryption key.

The Swap Out structure and process 4900 of FIG. 21 in some embodimentssuitably include a Swap Out Sequence Counter that is incremented at step4910 with each call to the Swap Out 4900 process. The counter maintainsa running count called a Swap Out Sequence Number. The keys referencedby KSelector roll over and are rearranged due to the Swap-out SequenceNumber (64 hits) incrementing in an ever higher binary count on everySwap-out operation. In this way, the keys are used round-robin for pageSwap-out in step 4950 of FIG. 21, for instance.

In some embodiments, the KSelector bits and the Swap Out Sequence Numberare hashed into the corresponding page PG_SLOT with the encryption keyto generate an HMAC for that page being Swapped Out. The KSelector bitsare situated in a predetermined location in the Swapped Page structure,such as related to the SDRAM_PG HEADER in data structure 3200A of FIG.12, and the Page Header Other Management Information of FIG. 14, andneed not be encrypted into the overall cipher text of the Swapped Pagestructure of FIGS. 14, 15, and 16.

In FIG. 21 step 4960, some embodiments hash the page PG_SLOT togetherwith a predetermined part of, or the whole of, SDP_INT_SEC_STORAGE 3160hierarchical hash data structure of FIG. 11. For encryption, bothrelated entities, PG_SLOT and the Page Header are encrypted togetherserially. Before the encryption is started, the 64-bit Swap Out SequenceNumber with Kselector bits is copied into the temporary holding variableat the predetermined location. After the encryption is completed, theKSelector bits are saved away in Secure RAM or securely elsewhere foruse in decryption by a later Swap In operation to re-load the samePG_SLOT at step 4870 of FIG. 20.

Turning to FIG. 22, secure booting and flashing operations in processor1030 of FIG. I (or baseband processor 1100 and/or apps processor 1400 ofFIG. 2) commence with a BEGIN 5105 and proceed to boot. Boot begins witha step 5110 that starts in a CS0 (chip select zero) memory space inon-chip ROM 1032 of FIG. 1 (or ROM 1130 and/or 1440 of FIG. 2 or 2040 ofFIG. 3). Next, a step 5115 checks eFuse bits called Production ID bits.If these Production ID bits have a predetermined value such as 00,operations branch to Other Code step 5118. Otherwise, operations go to aSecure Boot sequence, starting with a step 5140.

In FIG. 22, step 5140 executes a Secure mode entry sequence ofinstructions from on-chip ROM, e.g. 2040 of FIG. 3. The Secure StateMachine 1038 of FIGS. 1 and 2 (or 2060 of FIG. 3) is arranged in itshardware monitoring function to detect authorized characteristicspre-established for that Secure mode entry sequence of instructionsand/or its associated data. This Secure mode entry sequence ofinstructions and/or data is pre-programmed by manufacturer with theauthorized characteristics, and the ROM code enters secure mode. Securecode is executed at this time rather than user application code.

A further step 5150 executes ROM code to authenticate XLoader/2^(nd)boot code including Flash loader, for flash and other memoryauthentication such as described in FIG. 3. References to 2ND mean aFlash Loader software in the apparatus (such as a wireless handset). TheFlash memory 1025 is one example of a storage medium that has codedphysical representations of operations or instructions which processor1030 of FIG. I and hardware of FIG. 2 executes. The Flash Loader loadssoftware external to the apparatus via a serial interface (e.g., SSI,UART, or USB) into Flash memory 1025 in the cell phone 1010 of FIG. 1.References to XLoader mean bootstrap code that loads Code and/or Datainto or out of Flash memory.

In Secure mode, public initialization, secure initialization, andinterface initialization occur. In step 5150, Flash memory is checked todetermine what spaces are NAND flash, what spaces are NOR flash, and anyflash sub-types of Flash memory. Then a Table of Contents (TOC) issearched for presence of the loadable security kernel and SDPConfiguration structure SDP_CFG.

A TOC entry includes, for instance an address offset of a described itemfrom the TOC, a size in bytes of the item, a title string, and a TOC endaddress of the item. For one example, the boot operations of step 5150search the peripherals by querying the interfaces for a signal that adownload host, such as web site(s) 1055 or 1065 or PC 1070 from harddrive and/or optical disk or CD 1075, is trying to boot the system andchecks to see if the host has a valid TOC or other suitable informationrepresenting acceptable boot code. In step 5150, if no prospect for bootthrough a peripheral is found, then the external memory interfaces forNAND and/or NOR flash memory are accessed to detect a TOC with validinformation. Alternatively, the flash is accessed for other suitableinformation representing acceptable boot code, but the exampledescription of this paragraph is based on the TOC approach forconciseness. If no valid boot prospect is found, step 5150 returns anerror message and the system Secure Kernel takes appropriate defaultaction such as a warm reset. If a valid boot prospect is found, memorybooting or peripheral booting occurs as appropriate.

In a step 5160 of FIG. 22, a boot-time Secure Demand Paging (SDP)initialization process SDP_BOOT_INIT is executed to establish theconfiguration SDP_CFG 3130 of FIG. 11 in Secure RAM, as describedfurther in connection with FIG. 23.

Then in FIG. 22, a step 5165 exits Secure mode. Exit from Secure mode atstep 5165 of FIG. 22 makes secure ROM space inaccessible, SecurityControl Register SECCTRL inaccessible, and secure RAM space inaccessibleand establishes any other appropriate protections to additionally fostersecurity. In some embodiments, any subsequent attempts without re-bootto enter Secure mode, even by the special Secure mode entry sequence ofinstructions and/or data, is detected as a security violation andprotective measures follow immediately. For example, this approach issuitably used for Secure mode operations such as updating of Secret Dataof FIG. 3. Depending on embodiment, specified operations such asupdating of Secret Data occur by forced re-boot and/or occur at run-timeby entry into Secure mode. Step 5165 is also suitably put after step5170.

Next, a step 5170 executes a SDP_RUNTIME_INIT process of FIG. 24 to setup the data structures of FIG. 11 in Secure RAM and the data structuresof FIG. 12 and/or FIG. 13 in SDRAM, and by calling XLoader/2^(nd) Flashloader as appropriate for support.

Operations proceed at CONTINUE 5180 to execute the High Level OperatingSystem (HLOS) and User applications, including User applications innon-secure space that call protected applications (PAs). Secure mode issuitably reentered as needed to accomplish secure operations such as PAs2090 of FIG. 3 and as elsewhere described herein.

In FIG. 23, SDP_BOOT_INIT operations are detailed relative to step 5160of FIG. 22. SDP_BOOT_INIT operations commence with a call to BEGIN 5205.In a step 5210, a signed image called the SDP Certificate is downloadedfrom Flash memory 1025 to Secure RAM 1034 to configure SDP. The SDPCertificate is suitably OEM-configurable on a per product basis as anSDP Configuration Data Image SDP_CFG and signed. The Flash TOC (Table ofContents) points to the SDP Certificate as a secured item and data typein Flash memory. SDP Certificate is authenticated in the Secure bootprocess and imported into Secure RAM 1034. Signed means providing asignature in the sense used in secure communications technology.

Information portion SDP_CFG contains information to initialize SDP_CFG3130 of FIG. 11 with SDP_CFG information of TABLE 4. A cryptographicsignature portion provides the signature of the SDP Certificate. Step5210 of boot searches for this TOC item and imports SDP Certificate. Anon-SDP (non-SVM) configuration is recognized by the Secure Kernel if noSDP_CFG item turns up in the search of the TOC. In that case, SecureEnvironment ROM-related variables reserved for SDP usage are or remaininitialized and set to a predetermined value, such as zero.

SDP PPA 3120 of FIG. 11 is suitably executed to load the data structureSDP_VMC_CFG 3150 of FIG. 11 and VMC_CFG_ITEM of TABLE 6. In FIG. 23,some embodiments provide information for VMC_CFG_ITEM from the SDPCertificate and include VMC_CFG_ITEM in the SDP_CFG data structure 3130.For instance, determining the number of VMCs can represent a tradeoff.Using fewer VMCs, or only one VMC, with VMC re-use, reduces time thatmight be spent operating a VMC Switch Manager 4230 and switching VMCs.Using two or more VMCs additionally hardware-protects PA applets fromeach other and simplifies multi-threading. Accordingly, the datastructures are arranged for convenience to and accessibility by therespective authorized persons who are in the best position to determinetradeoffs and establish the various configurational aspects.

In FIG. 23, the SDP_BOOT_INIT process is suitably provided by a type ofSDP function called an Initialization Function in response to theone-time call at BEGIN 5205. SDP_BOOT_INIT provides and ensures 1)secure importation 5210 of the SDP Certificate into the SecureEnvironment, 2) Authentication 5220 of the SDP Certificate, 3) Validitydetermination 5230 of the parameters in the SDP Certificate, 4)Conversion 5240 of the SDP Certificate into the SDP_CFG structure 3130of FIG. 11 in Secure RAM, and 5) handshake with the ULOS signifyingcompletion of SDP_BOOT_INIT.

If Authentication 5220 fails or Validity determination 5230 finds anyinvalid SDP Certificate parameters, then operations branch to a step5250 to set one or more error flags representing the errors found.Operations proceed from either step 5240 or 5250 to a RETURN 5260.Function Arguments include a pointer to the SDP Certificate, and the SDPCertificate is returned. The Secure Kernel is arranged to set a pointerto the SDP Certificate by looking in the TOC (Table of Contents).

The function SDP_BOOT_INIT(SDP_CFG) is a function of the argumentSDP_CFG, the configuration structure 3130. This SDP function performsearly initialization of the secure environment, and is aninternal-only-supplied function which, to enhance security, is notexported to the non-secure environment. Secure Kernel includes a PPAcaller program from Secure ROM. The PPA caller program suitably hasalready authenticated a Security Certificate including the SDPCertificate so that the Security Certificate contains the OEM-specifiedconfiguration for instantiating the security of a particular productsuch as a cell phone model.

The OEM-specified configuration for security is passed in pertinent partto SDP_CFG 3130 in already-parsed binary form originated from the SDPCertificate pointed to by TOC. SDP Certificate in Flash is previouslyauthenticated, loaded to Flash memory, and tested and validated in aprevious secure process such as in manufacturing. In some embodiments,usage (or not) by OEM of SDP technique is selected by a configurationbit or field in an OEM- or manufacturer-provided certificate in Flashmemory 1025 and/or by a hardware E-fuse on chip having an on/offconductive state established at manufacture. Product alternatives of SDPand non-SDP (statically mapped Secure RAM) code usefully are located tostart at the same virtual address. In this approach, the SE environmentCode detects and takes into account a larger secure memory resource withthe SDP configuration than with a non-SDP configuration.

The SDP PPA is loaded and has access to the SDP_CFG 3130 receives theSDRAM_SDP_SIZE parameter of TABLE 4 that indicates the total size of theDRAM reserved from HLOS for the data structure of FIG. 12 to support SDPswap file operations. This parameter not only takes into account theFIG. 12 space SDRAM_PG for 4K pages but also the overhead size of theintegrity check variables and other spaces in areas 3200A and 3200B.

At step 5240, the SDP PPA provides two API function calls, for example.The first API function call to the non-Secure Environment indicates howmuch physically contiguous DRAM memory is reserved to SDP so as tonotify HLOS-associated secure driver. The second API function call is ahandshake by an HLOS-associated secure driver such as by passing aphysical pointer identifying to the SDP PPA the SDP swap areaSDRAM_BACKING_STORE_ADDR and SDRAM_BK_EXT_STORAGE_ADDR of TABLE 4 forexample. The second API function returns a value indicating success orfailure to the non-secure caller. If a success value is returned, theSDP is active and SDP Runtime Initialization of FIG. 24 is permitted. Ifa failure value is returned, the SDP Runtime Initialization isprevented.

In FIG. 24, a process for further initializing Secure Demand Pagingorganizes and loads software from Flash or download Host via Secure RAMinto the FIG. 12 data structure DRAM_PG_TRACK_ARRAY. FIG. 24 gives anexample of steps for FIG. 22 step 5170 to execute a processSDP_RUNTIME_NIT of FIG. 24 to set up the data structures of FIG. 11 inSecure RAM and the data structures of FIG. 12 and/or FIG. 13 in SDRAM.

SDP_RUNTIME_INIT is suitably provided as an Initialization Function thatestablishes the Virtual Machine Contexts (VMCs) in external DRAM as wellas initializing portions of Secure RAM of FIG. 11, by callingXLoader/2^(nd) Flash loader as appropriate for support.SDP_RUNTIME_INIT 1) initializes to zero (0) the fullSDP_EXT_BK_SEC_STORAGE Structure in SDRAM that is used at runtime by theExternal Secure Storage Manager 4250 of FIG. 17 to store Secureinformation, 2) allocates memory area SDRAM PG of FIG. 12 for thePG_SLOT Backing Store Pages, and 3) establishes the hierarchical BookKeeping data structure 3200B of FIGS. 12 and 3300 of FIG. 13.

SDP_RUNTIME_INIT is suitably written as an API that is one-time-onlycalled to initialize the SDP 4200 environment inside the Secure Modeprior to or at the beginning of runtime and after the SDP is configuredby SDP_BOOT_INIT step 5160 of FIG. 22 and FIG. 23. SDP_RUNTIME_INIT iscalled after the non-secure OS initialization/boot is complete, andbefore loading Non-Privileged Protected Applications (NPPA). ThisFunction is called after HLOS initialization completes when amulti-threaded (multi-process) secure environment is desired. If asingle VMC environment is configured, it is suitably called after theSDP_BOOT_INIT function executes.

The SDP_BOOT_INIT function of FIG. 23 suitably responds to aone-time-only call 5160 during secure boot of FIG. 22. TheSDP_RUNTIME_INIT function of FIG. 24 suitably responds to aone-time-only call as well. Any subsequent calls to either of these twoFunctions for service from any source after the respective one-time-onlycall, suitably result in such subsequently-called Function returning anerror. When such art error is returned, then for security purposes theFunction prevents re-execution of operations that were provided by theFunction in response to the original one-time-only call. This securityprotection is independent of, and coordinated with, the desirableoperations by Strategic Resolver 4210 in FIGS. 17 and 25 to get a newVMC and use VMC Switch Manager 4230 of FIGS. 17 and 26 to update memoryspaces and load the new VMC during runtime operations.

The SDP_RUNTIME_INIT function of FIG. 24 has, for example, the followingarguments:

1. SDP_PATCH_ELEMENT 2. VMC_Activate. 3. StartingPageStot 4.StartingPhysPageNum 5. EligiblePhysPageCount 6. PageTableSize

In FIG. 24, Function SDP_RUNTIME_INIT installs higher performance SDPpatch routines, if any, to augment the run-time performance andestablishes the VMCs according to the SDP_CFG configuration. FunctionSDP_RUNTIME_INIT arguments are described in more detail next. Note thatfunction arguments are process inputs to which SDP 4200 responds toestablish or execute operations.

SDP_PATCH_ELEMENT is an SDP Patch Structure pointer or patch list. Thispointer is allowed to be NULL, when no modifications to the current SDPfunctionality of a given embodiment are intended for the platform andmultiple VMC (Multi-VMC herein) capability is not configured.SDP_PATCH_ELEMENT is suitably used in an environment where securityservices are provided by the Security Kernel for loading extensibilitythrough secure applets. The code (contained in a PPA) for implementingthat new functionality is previously and entirely loaded in privilegedsecure mode before the Initialization Function SDP_RUNTIME_INIT iscalled.

SDP_PATCH_ELEMENT is an SDP Patch List that depends on manner in whichROM code is patched (Presequenced, Replaced, or Post-sequenced, withloadable PPAs). Patches to SDP-MGR are suitably all placed by thisFunction SDP_RUNTIME_INIT. Running this function SDP_RUNTIME_INIT tocompletion signifies to Secure Kernel and to SDP Strategic Resolver 4210that all SDP-related Secure Kernel patches and SDP 4200 patches are nowapplied. At this point SDP initialization is finalized and ready forsubsequent FIG. 25 runtime VMC get-new operations and switchingoperations by Strategic Resolver 4210 and calls to VMC Switch Manager4230 for operations of FIG. 26.

The arguments VMC_Activate, StartingPageSlot, StartingPhysPageNum,EligiblePhysPageCount, and PageTableSize are suitably supplied by orderived from the configuration information in SDP_CFG 3130 andSDP_VMC_CFG 3150 of FIG. 11.

VMC_Activate is an input flag argument that selects and activatesMulti-VMC functionality to support multi-threading. After return fromthis SDP_RUNTIME_INIT Function, Multi-VMC functionality is subsequentlyfully initialized such that SDP 4200 accepts control function calls thatinitialize, start, and switch between multiple VMCs. If this flag is setto False, SDP activates one VMC and multi-threading of non-privilegedapplications is not supported and the secure environment is limited toserialized calls. VMCs provide a robust and simplified multi-threadedenvironment.

StartingPageSlot is a parameter indicating the 4K-aligned startingaddress of the secure virtual memory in VAS. Let it be assumed thatExternal memory management and MMU have already allocated, createdand/or have reserved for their use, appropriate Page Directory EntriesPDE in a secure page directory in Secure ROM. The secure PDEs point toSDP Page Table Entries PTE (e.g. up to four with 4K each), as alsodescribed in connection with FIG. 4. Strategic Resolver 4210 locatesthese physical Page Tables via a direct access to the secure PDE[x]. ThePage Tables are aligned in physically addressed and contiguous SecureRAM on 4K Secure RAM boundaries (pages). In extended examples, SDP 4200utilizes four Page Tables to provide, in effect, 4 MB of secure virtualmemory as configured by OEM.

StartingPhysPageNum is a parameter indicating the physical address ofthe first Secure RAM page which identifies the start of the pool ofSecure RAM pages to be utilized by SDP for operations to dynamicallycreate a large secure virtual memory. For simplicity, the page number isthe physical PG address shifted-right by 12 bits.

EligiblePhysPageCount a parameter indicating the number of 4K physicalPages beginning at the address StartingPhysPageNum. The physical pagesare physically contiguous, so StartingEligiblePhysPageCount andStartingPhysPageNum fully describe the pool of Secure RAM pages to beutilized by SDP.

PageTableSize: is a parameter that ranges from zero to four, forexample, and identities the number of MegaBytes (MB) of secure virtualmemory in SDRAM. Zero is a special condition which indicates that demandpaging is not utilized, and configures and operates SDP 4200 AbortHandlers 4264 and 4268 for immediate pass-through with no decode orordinary SDP 4210 response to a Page Fault event.

In FIG. 24, operations of SDP_RUNTIME_INIT commence with a BEGIN 5405and have access to configuration parameters from spaces 3130 and 3150pertaining pointing to the SDP data structure of FIG. 11. Next, a step5410 sets and adjusts indices i, j, k to perform nested loops includingan inner first loop k N Pages per BBK, ara intermediate second loop j onL BBK for each VMC, and an outer third loop ion K VMCs.

The inner first loop k proceeds from step 5410 to a step 5415 to Load afirst (or next) PA pagewise from Flash memory 1025 of FIG. 1 (or by wireor wireless from a Download Host machine such as PC 1070, a secure website such as 1055 or 1065, or optical disk 1075 or other storage mediumholding coded physical representations) to Secure RAM. Step 5415decrypts and authenticates any encrypted, signed page. Further in step5415, operations set the state of an integrity flag and confidentialityflags for each page 1. These flags are set depending on securityinformation that is suitably pre-stored with the PA itself and/oraccording to security policies established in the Secure Kernel, in theSDP PPA, and in the configuration such as in spaces 3130 and 3150. AnInitial Vector IV for a page is set to a random value or otherwiseaccording to security policy. A first space data1 of the page isinitialized with any appropriate data. A second space data2 of the pageis initialized with a fixed pattern, or with a hash of the contents offirst space data1, depending on embodiment.

A succeeding decision step 5420 determines whether the ConfidentialityFlag(i,j,k) for the page is set active. If Yes, then operations proceedto a step 5425 to encrypt the contents data1 concatenated with data2(data1∥data2) using AES CBC Mode, Key Encryption Key KEK, and InitialVector IV as one example of many possible encryption methods.

After step 5425, or after No in step 5420, operations go to a decisionstep 5430 to determine whether the Integrity Flag(i,j,k) for the page isset active. If Yes, then operations proceed to a step 5433 to Hash thecontents of first space data I of the page and store the hash result ina hash field of the header of Page k in Secure RAM of FIG. 11. If No instep 5430, then operations go to a step 5435 to fill the hash field ofthe header of Page k with a fixed pattern.

The Confidentiality flags and Integrity flags are page-specific invarious embodiments in the sense of being able to specify some pages andnot others. These flags are regarded as page-specific when they specifyall pages in a block book keeping block BBK or all pages in a virtualmachine context VMC without necessarily being granular to page-level insome embodiments.

After either step 5433 or 5435, operations go to a step 5440 to storethe Hash header hash result in the hash field 3230 of the k-th BK BookKeeping element kin SDRAM of FIG. 12 and/or FIG. 13. Then the internalpage k itself, as encrypted (or not) in steps 5420-5425, is stored toarea SDRAM_PG in area 3200A of SDRAM. In step 5440, a virtual page mapis established and updated in Secure space to map and relate the virtualpage addresses to the VMC/BBK/BK [i,j,k] hierarchy in SDRAM of FIG. 12.At this point the inner first loop k operations 5415-5440 are completed,and the process flow of loop k loops back to step 5410 to repeat theinner first loop k for all N Pages for a given BBK.

Further in FIG. 24, when the inner first loop k is repeated andcompleted for all N Pages for a given j-th BBK, operations proceed to astep 5450. Step 5450 Hashes the N Book Keeping elements of the j-th BBK.The Hash result is stored in a j-th BBK hash field BBK_HASH[j] of i-thVMC I in Secure RAM of FIG. 11 and similarly into SDRAM in space 3210 ofFIG. 12 and/or BBK HASH area of FIG. 13. At this point the intermediatesecond loop j operations 5415-5450 are completed, and the process flowof loop j loops back to step 5410 to repeat the inner loop k andintermediate second loop j BBK by BBK for all of the Block Book KeepingBBK blocks which are numerous in an amount specified by the number L ina given VMC.

Still further in FIG. 24, when the intermediate second loop j isrepeated and completed for all L Block Book Keeping BBK blocks of oneVMC, then operations proceed to a step 5460. Step S460 Hashes the L hashvalues BBK_HASH[j] concatenated together for the i-th VMC[i]. The Hashresult is stored in an i-th VMC hash field SDP_VMC_HASH[i] of the SDPdata structure SDP_INT_SEC_STORAGE 3160 in Secure RAM of FIG. 11 andsimilarly into SDRAM in space 3240 of FIG. 12 and/or the VMC_HASH areaof hierarchy 3300 FIG. 13.

At this point the outer third loop i operations 5415-5460 are completed,and the process flow of loop i loops back to step 5410 to repeat for thenext VMC the inner loop k, the intermediate second loop j BBK by BBK forall of the Block Book Keeping BBK blocks in the next VMC, and then theouter third loop i for the next VMC. In some embodiments, the process isrepeated over and over again, VMC-by-VMC, until all VMCs are processed.The VMCs are numerous in an amount specified by the number K. In otherembodiments, the process is repeated to put one PA or somefrequently-used PAs into the VMCs, and space is left over for other VMCsto be added and/or switched in as described in FIGS. 25 and 26.

Upon completion in FIG. 24 of outer third loop i, operations proceed toa step 5470. Step S470 Hashes the K hash values of the set of VMCs (K innumber) and stores the result in another hash field in space 3240 inDRAM of FIG. 12 and final_hash of FIG. 13 and in a top-level hash fieldin space 3160 in the Secure RAM of FIG. 11, whence a RETURN 5495 isreached.

Some embodiments use non-volatile on-chip memory 1036 to store thehashes at each level, and other embodiments do this hash storage inSecure RAM 1034 using an always-powered hash storage register, toprotect against playback or replay attacks, for instance.

In FIG. 24 SDP_RUNTIME_INIT initializes the SDP data structures of FIGS.11-13 for use at run-time and provides initial values of thehierarchical Book Keeping structure. Various embodiments provide fordifferent levels or numbers of loops of the hashing in FIG. 24. Theprocess of FIG. 24 is repeated as appropriate on re-boot and soft reset.For example, SDP_RUNTIME_INIT is an API that is accessible inside thesecure ROM Code only by the Secure Kernel in privilege mode.

In FIG. 25, Strategic Resolver 4210 has an SDP Initialization Sequencefor a new VMC. The sequence occurs as often as a new VMC is loadedduring run-time even in the absence of some reset event. The operationalblocks of process and structure 5600 in Strategic Resolver 4210 arefirst described as a whole flow of FIG. 25 and then various operationalblocks are individually described in further detail.

Operations 5600 in Strategic Resolver 4210 commence at a BEGIN 5605 ofan SDP initialization sequence. Initialization sequence operations go toa decision step 5610 to determine whether resolving a Page Fault needs aparticular page from SDRAM associated with a new VMC. New VMC means aVMC that does not pertain to pages that are the main subject ofoperations being executed out of Secure RAM.

Suppose in step 5610 that the determination is Yes that a page from anew VMC has not already been Swapped In to Secure RAM from SDRAM. Thenoperations proceed to a step 5615 to identify the new VMC by accessingthe virtual page map that was established by step 5440 to relate virtualpage addresses to the VMC/BBK/BK [i,j,k] hierarchy in SDRAM of FIG. 12.Some embodiments pre-establish the VMC information in SDP? CFG for usein Step 5615. Step 5615 calls an Operational Function SDP_VMC_GET_NEWthat identifies the VMC index i in which the needed page resides andreturns a function argument New_vmc with that value specifying the VMCthat is needed to resolve the Page Fault,

Then operations proceed to a step 5620 designatedSDP_VMC_SWITCH(New_vmc) to perform the VMC switch of FIG. 26. Forexample, a new VMC can be needed if one PA calls another PA, or when aUser application has finished using one PA and subsequently callsanother PA.

From step 5620 in FIG. 25, operations go to a decision step 5625 todetermine whether the new VMC is Activated. If No, then operationsproceed to activate the VMC in a step 5630 SDP_VMC_ACTIVATE(param) basedon parameters pertaining to the VMC.

Next, a step 5635 uses a SDP_VMC_CODE_DATA_FLAG that establishes therequested page Type as Code or Data. If Code, then a step 5640 1)responds to the SDP Abort Handler 5645 pertaining to Prefetch AbortHandler 4264 of FIG. 17, 2) calls Scavenger 4300 of FIG. 18 and finds aPHYS_SEC_PG in Secure RAM, 3) Swaps In the requested Code page PG_SLOTfrom SDRAM into PHYS_SEC_PG in Secure RAM as shown in FIGS. 18, 19 and20, and 4) goes to step 5655. If not Code in step 5635, then operationsgo to step 5655.

Step 5655 uses the SDP_VMC_CODE_DATA_FLAG in the case of a requestedData page to activate step 5660. Step 5660 1) responds to the SDP AbortHandler 5665 pertaining to Data Abort Handler 4268 of FIG. 17, 2) callsScavenger 4300 of FIG. 18 and finds a PHYS_SEC_PG in Secure RAM, 3)Swaps In the requested Data page PG_SLOT from SDRAM into PHYS_SEC_PG inSecure RAM as shown in FIGS. 18, 19 and 20, and 4) goes to step 5670. Ifnot Data in step S655, then operations go to step 5670.

Further considering decision step 5625, if the new VMC is alreadyactivated, then operations go from step 5625 (Yes) directly to step 5670wherein the VMC is running the application. The intervening steps5630-5660 are bypassed. Further considering decision step S610, if noswitch to a new VMC is needed, then operations go from step 5610directly to step S670 wherein the Strategic Resolver 4210 stands readyto handle Page Faults generated by the application in the currentlyactive VMC. Some embodiments use a combined flow in Strategic Resolver4210 wherein the operations go from step 5610 to 5635 and load the pageinto Secure RAM for the currently ing VMC. In such embodiments decisionstep 5625 (Yes) then goes to step 5635 too.

In FIG. 25, after step 5670, a decision step 5675 determines whether theapplication execution of step 5670 is complete. If not complete (No) atstep 5675, operations go to a decision step 5680 to determine if anasynchronous message buffer or other page lock needs to be set up. If Noin step 5680, operations continue running the application in step 5670.

If Yes in decision step 5680, PA or an Interrupt Handler is calling orrequesting Strategic Resolver 4210 to set up a Locked page whether ornot a Page Fault is involved. Strategic Resolver 4210 operations respondto the Yes condition at step 5680 by proceeding to a step 5690 to Look apage, such as by calling a process SDP_VMC_UPDATE_PG_STATUS or executinga process of FIG. 27 as described elsewhere herein.

Depending on embodiment, Lock pertains to one page or alternatively thePA requests a specified number of pages within a permitted range to beLocked, and Strategic Resolver responds. This decision step 5680represents a Call, an interrupt-driven operation or polling operationdepending on the nature of the embodiment. Once the page Locking isperformed, operations go to step 5670 to continue running theapplication. Each Locked page is then suitably used to support theapplications code and any interrupt-driven operation or pollingoperation of the application.

In decision step 5675, if the application execution of step 5670 iscomplete (Yes at step 5675), then operations branch to step 5685 tooptionally operate the Scavenger 4220 of FIG. 17 (4300 of FIG. 18).Scavenging at step 5685 and at steps 5640 and 5660 in the process 5600occurs according to a time allocation that puts scavenging in processoridle periods, when possible. For example, suppose the processor has anidle loop involving a Halt that yields to HLOS wherein interrupts inHLOS cause pre-emption of the Secure environment. During the lowactivity interval, the Scavenger 4220 suitably detects any pages withdormancy, in usage, while dispatching those pages found dirty for SwapOut. This scavenging process serves to optimally keep ahead of futurepage demands by freeing dormant pages, with respect to applicationaccess, such that future application page demands can be resolvedquickly with free pages from a free page pool.

Step 5685 applies to certain embodiments that perform pro-active pagewiping by Scavenger 4300 to maintain one or more empty pages PHYS_SEC_PGin Secure RAM. In such embodiments, processor 1030 signals alow-activity interval or status of processor 1030 pertaining to any ofseveral names such as Idle, Standby, Sleep, or otherwise as appropriate.Pro-active page wiping is established by Strategic Resolver 4210checking the PA2VA and determining that Secure RAM is fully utilizedaccording to a definition such as the number of physical pages currentlyin use exceeding a threshold number.

If Full, Strategic Resolver 4210 sets a No Swap In Flag (NSI Flag)before calling Scavenger 4300 by step 5685. Thereupon, Scavenger 4300operates as in FIG. 18 with the selective operation that Swap In step4390 of FIG. 18 is disabled or bypassed on the pro-active page wipingcycle. When Strategic Resolver 4210 in FIG. 25 determines that PA2VA isnot Full, in that one page or some predetermined number of Secure RAMpages PHYS_SEC_PG is/are Empty, then step 5685 scavenging is bypassed.When Strategic Resolver 4210 subsequently calls Scavenger 4300 in step5640 and/or 5660 of FIG. 25, the Page Fault is resolved by Swapping Into an empty page PHYS_SEC_PG quickly via Empty Page decision step 4330of FIG. 18 going directly to Swap In step 4390.

Operations 5600 complete at a RETURN 5695 and go from Strategic Resolver4210 of FIG. 17 to SDP step 4255 or 4265 and to RETURN 4270 to SecureKernel.

Some particular steps in FIG. 25 are detailed further hereinbelow.

In FIG. 25, step 5615 performs the function SDP_VMC_GET_NEW. Thisfunction returns a free VMC index designated New_vmc analogous to orreferring to the VMC_INDEX_LOCKED variable in the SDP_VMC_CFO Structure3150 of FIG. 11. The variable VMC_INDEX_LOCKED is parsed bit by bit.When a free VMC Index value is found, the value is designated as a valueNew_vmc and a presence bit for it is set (e.g., to one (1)) and returnedto the Strategic Resolver 4210. This process is suitably madeuninterruptible. The function does not need to have any argument.

Step 5615 returns the value New_vmc that associates a VMC with the PA tobe executed and for which a page is requested. This value New_vmc isused for subsequent step 5620 to call Operational FunctionSDP_VMC_SWITCH(new_vmc) of FIG. 26. Step 5620 causes SDP 4200 to revisethe VMC VAS space to accommodate a specific PA to be executed. A statusfield VMC_HANDLE of TABLE 10 for the VMC also include bit(s) forpredetermined error diagnostic value(s), when returned by step 5615 or5620, to indicate that the new VMC is not instantiated due to an invalidconfiguration or other reason specified by the error diagnostic value.If the predetermined error value is returned by function SDP_VMC_SWITCH,Strategic Resolver 4210 takes appropriate remedial action. The valueNew_vmc is suitably included in the VMC_HANDLE field.

TABLE 10 FIELDS IN VMC_HANDLE Value Description New_vmc VMC index forthe new VMC. See Function SDP_VMC_GET_NEW ERROR Error diagnostic bitsfield. New_vmc is set to error value too. ERROR_MINSLOT Locking hasreduced or imminently will reduce the number of wipeable pages below theMINSLOT minimum. Fields for Return Values From VMC Switch Manager 4230:NEW_VMC_NOT_INIT New VMC is available in DRAM but not accessible inSDP_VMC_CFG 3150 of Secure RAM. New VMC is not yet initialized withrequest parameters VMC_ACTIVATION_REQUEST The new VMC requested is notin DRAM. VMC_DEACTIVATION_REQ Request for Deactivation of a VMC.VMC_READY New VMC is initialized. VMC_PGLOCK VMC to which a Page Lock isdirected. VMC_OTHER_PGLOCK Bit signifying Scavenger wiping advisor isneeded before Locking a page. PG_FLUSH_START Bit signifying Scavengerneeds to flush a specific page. VMC_OTHER_ PGRELEASE Bit used inreleasing Locked page and restoring a page. Page Locking Across VMCs:STATUS Commands a page be locked or unlocked. -00 No page status change-01 Lock the Page -10 Unlock the Page (Lock Release) -11 Page lockingerror Field accompanying VMC_HANDLE PG_SLOT_INDEX Virtual Address of apage to be locked or unlocked (Physical page address with PA2VA isalternative.)

In FIG. 25, VMC Activate step 55307 is implemented, for example by anOperational Function SDP_VMC_ACTIVATE. The function SDP_VMC_ACTIVATEstarts a VMC to support a new secure virtual memory context and providesecure memory space for a new NPPA to be loaded. In this way, inembodiments that do not load all PAs from to Flash to DRAM except asneeded, the new VMC is added to SDRAM and to Secure RAM when a PageFault occurs that demands a new PA and new VMC. In other embodimentsthat have pre-loaded all PAs from Flash to DRAM, and the number of PAsexceeds the maximum number NUM_VMC of VMCs identified with values ofindex i, then SDP_VMC_ACTIVATE provides a VMC index i for a PA that doesnot currently have a VMC index i. SDP_VMC_ACTIVATE further sets up theSDP_VMC_CFG space 3150 as described herein for the PA as a new VMC.

For activating a new VMC that is in Flash and not SDRAM, the functionSDP_VMC_ACTIVATE operates like the process of FIG. 24 on inner loop kand intermediate loop j using steps 5410-5450, followed by step 5460once for the one additional VMC being selectively activated, and thensteps 5470 and 5495. The operations of FIG. 24 are selectivelycontrolled to include 1) a first alternative of initializing a set ofvirtual machine contexts, as in runtime initialization, and 2) a secondalternative of activating a single virtual machine context to updatesuch a set, as in SDP_VMC_ACTIVATE.

For activating a new VMC that is in SDRAM because of previous executionof SDP_RUNTIME_INIT of FIG. 24 but currently not in Secure RAM, thefunction SDP_VMC_ACTIVATE sets VMC_CURRENT_INDEX to New vine anddownloads the VMC image 3200B of FIG. 12 or 3300 of FIG. 13 to SecureRAM from SDRAM.

The function SDP_VMC_ACTIVATE sets the appropriate parameters such asfunction arguments for VMC index VMC_CURRENT_INDEX, the VAS sizeVMC_VAS_SIZE, and the number of Code pages NUMBER_OF_CODE_PHYS_SEQ_PG inthe data structure 3150. Some of these parameters are suitably specifiedby OEM. Some parameters depend on particulars of hardware protectioncapabilities of the MMU. Some parameters for the VMC depend on thenature of the PA to be loaded and are provided in a PA Certificatesupplied with the PA.

The argument VMC_CURRENT_INDEX in the area 3150 of FIG. 11 supplies theindex [i] of the VMC data structure. Argument NUMBER_OF_CODE_PHYS_SEC_PGspecifies a partition between DATA and CODE secure pages PHYS_SEC_PG forthose embodiments that allocate pages by code and data Type in theSecure RAM space for the VMC. Page wiping and loading of a new pagePG_SLOT is then performed subject to the allocation constraint. DATA orCODE type information is correspondingly entered into TYPE bits of asecure register SDP_PAGE_TYPE for each physical page PHYS_SEC_PG ofSecure RAM. Argument VAS_SIZE tells the External Secure Storage Manager4250 the size of the virtual address space for this particular VMC thatis subject to Swapping and Book Keeping.

In response to SDP_CFG parameters and specific hardware protectioncapabilities of the MMU, this function SDP_VMC_ACTIVATE accommodatesNPPAs by partitioning the VMC between Stack, Data and Code as in FIG.10. Stack, Data and Code segments are suitably allocated in 4K pages andhave a No-Execute attribute for Stack, and page Type register bit forData pages. The process allocates the private stack for an NPPA at thebeginning (low address end) of the VMC VAS. The NPPA stack is isolatedand protected in case the NPPA stack exceeds its size bound on itslowest address in embodiments wherein the stack grows towards lowermemory addresses. In other words, the stack crosses a predeterminedboundary in the VAS. In this way, a security violation such as a replayattack on the stack is readily detected. SDP_VMC_ACTIVATE positions Datasegments in VMC VAS in addresses that are followed by the addresspositions of the Code segments.

Some embodiments establish a one-to-one mapping of NPPAs in order of theVMCs up to the NUM_VMC maximum number defined in the SDP-CFG. Eachconsecutive Call to this function SDP_VMC_ACTIVATE creates one VMC percall. This mapping and creation of VMCs supports OEM configuration ofdifferent VMCs with different sizes VMC_VAS_SIZE via the SDP_CFGconfiguration structure.

Function SDP_VMC_ACTIVATE returns a value in the bit-field VMC_HANDLE ofTABLE 10 associated with each NPPA VMC loaded by Strategic Resolver4210. This VMC_HANDLE value is used for any subsequent calls to functionSDP_VMC_SWITCH of FIG. 26 that cause SDP 4200 to change the VMC VAS fordifferent NPPAs to be executed. A value of zero, when returned bySDP_VMC_ACTIVATE, indicates that an error occurred, and the VMC couldnot be instantiated due to an invalid configuration. The fieldVMC_HANDLE is also used as a status field and error diagnostic for thefunction SDP_VMC_SWITCH of FIG. 26.

Function SDP_VMC_ACTIVATE is run on-demand as shown at step 5630 of FIG.25. Also, Function SDP_VMC_ACTIVATE is run proactively in someembodiments by a prediction mechanism using information available inadvance of need of VMC activation. Then the VMC activation operation isscheduled for a period of lower processor activity as discussed inconnection with step 5685 of FIG. 25 or parallelized to make the systemoperate very efficiently.

FIG. 26 depicts a VMC Switch Manager 5620 process, which in an exampleis established by an Operational Function SDP_VMC_SWITCH. FunctionSDP_VMC_SWITCH is called by the Strategic Resolver 4210 of FIG. 17 andFIG. 25 for switching the VMC VAS to allow one or more of a differentset of NPFAs to execute. The SDP VAS is re-mapped, and fully re-mappedas by the SDP_RUNTIME_INIT process of FIG. 24 if necessary. A revisedand/or different area of the DRAM-SWAP space is thereupon utilized bySDP for servicing page faults for the new VMC. Each VMC VAS is allocatedits own private set of backing DRAM pages in the external DRAM datastructures of FIG. 12 and FIG. 13.

An index New_vmc is provided and used internally to access an array ofVMCs in the SDP_VMC_CFG data structure 3150 of FIG. 11. The SDP_VMC_CFGstructure contains pointers to each VMC. The range of index New_vmc isfrom one (1) to configuration value NUM_VMC in SDP_CFG 3130 of TABLE 4.

Function SDP_VMC_SWITCH 5620 has New_vmc suitably included in anargument VMC_HANDLE, which is supplied by the caller process such asStrategic Resolver 4210 and utilized internally as an array index intoSDP_VMC_CFG data structure 3150. SOF_VMC_CFG consecutively contains eachVMC structure as partially defined and initialized by theSDP_RUNTIME_INIT function of FIG. 24 and updated by Strategic Resolver4210 in FIG. 25 and SDP_VMC_SWITCH of FIG. 26 to form the latest updatedarray for SDP_VMC_CFG data structure 3150.

In FIG. 26, step 5620 of FIG. 25 commences operations of SDP_VMC_SWITCH() at point 5710. The value VMC_HANDLE of TABLE 10 is checked for anypredetermined value indicative of an error condition before argumentNew_vmc is utilized as an index into the SDP_VMC_ARRAY of SDP_VMC_CFG3150.

A decision step 5720 determines whether there is an active VMC in SecureMode in the sense of being available in SDRAM. If decision step 5720determines No, then operations branch to a step 5770 and return a VMCActivation Request datum VMC_ACTIVATION_REQUEST such as in a subfield ofVMC_HANDLE. In this way, when operations thereafter reach step 5625 ofFIG. 25, the operations go to step 5630 to Activate the new VMC bydownload of information and pages pertaining to the new VMC from Flashin the manner of a further iteration of the process FIG. 24 for the newVMC.

In FIG. 26, if decision step 5720 determines Yes, then operations go toa second decision step 5730 to determine whether the VMC_Index is lockedire VMC Index Initialization VMC_INDEX_LOCKED. Decision step 5730 makesthis determination whether the requested VMC is already initialized inthe sense of being available in SDRAM but not accessible in SDP_VMC_CFG3150 of Secure RAM in FIG. 11. If the VMC_Index is not locked, thenoperations at a step 5740 return a datum NEW_VMC_NOT_INIT, such as in asubfield of VMC_HANDLE, that the new VMC is not initialized. In thisway, when operations thereafter reach step 5625 of FIG. 25, theoperations go to step 5630 to Activate the new VMC by download ofinformation pertaining to the new VMC from area 3200B of SDRAM.

If the VMC_Index is locked in the sense that the requested VMC isaccessible in SDP_VMC_CFG 3150 of Secure RAM of FIG. 11, then operationsgo from decision step 5730 to a step 5750.

In step 5750, a determination is made whether the SDP_VMC_CFG 3150 isfull of VMCs. If Full, then operations call the functionSDP_VMC_DEACTIVATE. If Not Full, then operations at step 5750 partiallyclean the area of SDP_VMC_CFG 3150 pertaining to the current VMC fromwhich the switch to New_vmc is being made.

If Not Full, step 5750 partially cleans as to current VMC as follows: 1)clean the entries VMC_MMU_TABLE, 2) clean the VMC_CURRENT_INDEX to apredetermined value such as all-ones, 3) Unlock all locked pagesPHYS_SEC_PG in Secure RAM of the current VMC, 4) clean the VMC_PA2VAarray for the current VMC, and 5) clean the PG_SLOT_FLAGS.

Notice that the step 5750 operates on page-specific locking dataestablished in the secure memory space and alters the page-specificlocking data in-place by unlocking free of rearrangement of the lockingdata.

If Full, Deactivation SDP_VMC_DEACTIVATE is applied to the current VMCbeing used prior to the new VMC, or applied to a VMC in a VMC-wipingprocess analogous to the page-wiping process or by another appropriatepolicy depending on embodiment, and unlocks all locked pages PHYS_SEC_PGof the VMC being Deactivated. VMC Deactivation is also suitablyperformed during a processor Idle condition or other interval ofprocessor lower-activity, such as discussed in connection with step5685. Operational Function SDP_VMC_DEACTIVATE has an argument New_vmcthat indicates the index of the VMC that is processed. This index rangeis from 1 to NUM_VMC of TABLE 4. A VMC_CURRENT_INDEX is suitably set toanother predetermined value (e.g., all ones) for a de-activated VMC.

Function SDP_VMC_DEACTIVATE is responsible to de-activate a VMC from theSecure Environment by cleaning the VMC Configuration item SDP_VMC_CFG3150 in Secure RAM (FIG. 11) related to the VMC_Index for the VMC to bedeactivated. Cleaning the SDP_VMC_CFG 3150 in Secure RAM includes stepsof 1A) clean the entries VMC_MMU_TABLE, 1B) clean the VMC_CURRENT_INDEXto a predetermined value such as all-ones, 1C) clean the VMC_ACTIVE andVMC_INDEX_LOCKED fields to unlock all locked pages PHYS_SEC_PG in SecureRAM, 1D) clean the VMC_PA2VA array for all entries related to theremoved VMC_CURRENT_INDEX, and 1E) clean all fields in the areaVMC_CFG_ITEM.

Operations go from step 5750 to a third decision step 5760 to determinewhether the new VMC has already been activated. If No, then operationsgo to the step 5770 and return the VMC Activation Request datumVMC_ACTIVATION_REQUEST.

Suppose decision step 5760 determines Yes, and operations now reachcomposite step 5780 that includes steps 5782, 5784, 5786. This conditionoccurs, for example, when a PA has been called by a User application,the PA has completed, and then the PA is called again by a Userapplication. In such case, the VMC has already been activated and thenew VMC is already represented in SDP_VMC_CFG 3150. In other words, aswitch from the current VMC to the new VMC in Secure RAM is to beperformed.

In composite step 5780 the VMC switch is performed by switching in thenew VMC and reconstituting its fields in SDP_VMC_CFG 3150 in Secure RAM.Operations proceed to 1) rebuild MMU Tables in a sub-step 5782 based oninformation in the VMC_PA2VA array of the new VMC, 2) Initialize/updatethe Secure registers in a sub-step 5784 so Scavenger 4220 in FIG. 18 andincorporated patent application TI-39617, Ser. No. ______, canadminister Secure RAM for the new VMC. Such secure registers includepage TYPE (Code/Data) register, Dirty Page WR Register, statisticsregister STAT, page activation register ACT, and page wiping advisorregister ADV. For page type-allocation and other embodiments, update thesecure registers for the new VMC by reading the SDP_VMC_CFG structure3150 and the SDP_CFG structure 3130 including CODE_DATA of TABLE 4 toupdate the ACT secure register, 3) Set the VMC Current IndexVMC_CURRENT_INDEX to the new index New_vmc in a sub-step 5786.

After completion of composite step 5780, operations at step 5790 returnthe datum VMC_READY such as in a field of VMC_HANDLE.

In FIGS. 25 and 26, Locking and Unlocking of pages is performed in afirst process example by an Operational FunctionSDP_VMC_UPDATE_PG_STATUS. This Function has a first argument calledSTATUS to command a page to be locked as in step 5690 of StrategicResolver 4210, unlocked as in step 5750 as VMC Switch Manager 4230, orrelocked as in step 5640 of Strategic Resolver 4210. This Function has asecond argument PG_SLOT_INDEX that specifies a virtual address (oraddress offset) that is mapped to secure physical page PHYS_SEC_PG ofSecure RAM. Some embodiments specify the physical page address itself bythe second argument.

In some embodiments, a status entry in the page Activation register ACTpertains to the particular PHYS_SEC_PG to which PG_SLOT_INDEX indirectlyor directly points. In such embodiment, this functionSDP_VMC_UPDATE_PG_STATUS suitably changes the status entry in the pageActivation register ACT. The active or inactive state of each physicalpage-specific ACT bit respectively defines for each PHYS_SEC_PG inSecure RAM whether that PHYS_SEC_PG is or is not used in the Scavengermechanism. The ACT register of TABLE 9 thus defines whether the page isincluded in or effectively removed from the pool of PHYS_SEC_PG pagesavailable for page wiping by Scavenger 4220 of FIG. 18. Thus the ACTRegister can also appropriately be named a Page LOCK register in suchembodiment. (Page Locking in the ACT Register is independent ofinitializing a VMC index as tabulated in the VMC_INDEX_LOCKED field ofTABLE 5 of SDP_VMC_CFG 3150 of FIG. 11.)

In other embodiments, the Lock status is maintained as a STATUS field bysoftware, such as shown for example in TABLE 9. Operations for lockingand unlocking refer to either or both of the STATUS field and the ACTregister.

Suppose a virtual page PG_SLOT is not already present in Secure RAM andneeds to be Locked. A call to Function SDP_VMC_UPDATE_PG_STATUS Lockssuch a page by calling Scavenger 4220 of FIGS. 17 and 18 to identify aparticular physical page PHYS_SEC_PG as the lock target and wipe andSwap In or reload PG_SLOT to that PHYS_SEC_PG. The PHYS_SEC_PG isprepared for its intended use, such as handling messaging orasynchronous events such as interrupts. The virtual address of PG_SLOTis mapped to the address of lock target PHYS_SEC_PG by writing (FIG. 19)to PA2VA and/or PG_SLOT_FLAGS of FIG. 11. With PG_SLOT now Swapped In toPHYS_SEC_PG, the PHYS_SEC_PG is marked as Locked, the STATUS bit(s) forthe page are set to 01 (Locked in TABLE 9) and the PHYS_SEC_PG is nowprevented from being wiped by the Scavenger 4220.

If virtual page PG_SLOT of the current VMC[i] is already present at theappropriate PHYS_SEC_PG, Function SDP_VMC_UPDATE_PG_STATUS takes thefollowing actions: 1) Checks the PG_SLOT to insure that physical pagePHYS_SEC_PG in Secure RAM is slotted or assigned to PG_SLOT and thusbypasses Scavenger 4220 and 2) Marks the slot PG_SLOT as Locked, theSTATUS for the page is set to 01, and thus is made Ineligible for wipingby Scavenger 4220. No further PG faults occur for a Locked page becausethe page is being held as always-present in the VMC VAS.

Applications and certain Pages can benefit from being Locked foroperations like delivering asynchronous messages into PA message bufferssuch as in FIG. 27. The Locking function is utilized appropriately forshort periods of time sparingly and as necessary, to thereby maintainhigh performance of the overall system. Also, in some embodiments SDP4200 establishes a minimum space parameter MINSLOT of TABLE 5 thatprovides, for instance, that at least two Secure RAM pages are empty orare pages mapped into wipeable slots, MINSLOT is suitably set by eitherSDP boot initialization of FIG. 23 and/or runtime initialization of FIG.24. ACT register, in effect, marks these physical pages as victimPG_SLOT candidates for wiping prioritization operations or wiping queueof the Scavenger. If locking has reduced, or imminently will reduce, thenumber of wipeable pages below the MINSLOT minimum, an error is returnedin VMC_HANDLE of TABLE 10.

In a second process example, two Functions are respectively provided forLocking and Unlocking either as an alternative to, or in support of, thefirst example Function SDP_VMC_UPDATE_PG_STATUS. These two Functions aredesignated SDP_VMC_PageLock and SDP_VMC_PageLockRelease.

In the second process example, a page locking Function SDP_VMC_PageLockhas arguments VMC_HANDLE and PG_SLOT_INDEX

Page locking Function SDP_VMC_PageLock is suitably employed to passasynchronous messages (e.g., secure interrupt handling) to a particularLAPPA or any similar purpose. The process example of FIG. 27 freezes thecode execution state of a currently-active VMC[i] during a period inwhich Page Locking is active for another VMC. Thus, if a message isdesired to be copied into another VMC[m] that is not the currentlyactive VMC[i], it can be done. In FIG. 27, code executing the currentVMC[i] is frozen until the PCB-LOCKs are released and removed for theother VMC[m] that is a destination for an asynchronous message such asmessage data copied into a message buffer existing in the VMC[m] VAS.

The VMC_HANDLE parameter indicates by field VMC_PGLOCK the VMC[i] orVMC[m] to which the Page Lock is directed. For instance, VMC_PGLOCK isset by operation of the PA that is making itself available as adestination to receive a message. VMC_PGLOCK is set to the VMC index ofthe VMC of that message-destination PA itself. That message-destinationPA also provides the PG_SLOT_INDEX of its designated message destinationpage to a storage element or data structure used by the InterruptHandler to vector incoming information to the virtual page atPG_SLOT_INDEX.

If the VMC for the Page Lock is not the currently active VMC[i], or ifthe PG_SLOT to be locked is not currently in Secure RAM, then Scavenger4220 of FIGS. 17 and 18 is operated to identify an empty or wipeablepage and update VMC_HANDLE. The PG_SLOT_INDEX parameter with VMC_HANDLEindicates the actual PG_SLOT which is requested to be locked or isidentified by Scavenger. This PG_SLOT_INDEX parameter is suitablyspecified as a virtual address offset for the PG_SLOT from the baseaddress of the destination VMC VAS, and the 4K LSBs inside the page canbe omitted.

Unlocking a page is accomplished by a second FunctionSDP_VMC_PageLockRelease. Function SDP_VMC_PageLockRelease has argumentsVMC_HANDLE, and PG_SLOT_INDEX. This function releases Page Locks whichhave previously been issued by the function SDP_VMC_PageLock. The LockRelease is issuable for any PG-LOCKed PG_SLOT in any VMC. This functionSDP_VMC_PageLockRelease releases a single VMC PG_SLOT in the VMC VAS. Ifmultiple PG_SLOTs need release, the function in this embodiment isrepetitively called even if and when the PG_SLOTs are contiguous in theVMC-VAS. More complex embodiments suitably provide multiple releasesaccording to the teachings herein.

When SDP_VMC_SWITCH function is called in FIG. 26, PG_SLOTs that arePage Locked, other than the newly specified (targeted) VMC, are releasedin step 5750 or even prior to calling function SDP_VMC_SWITCH. In someembodiments, the currently-active PA is responsible prior to the switchto release its Page Locks and SDP_VMC_SWITCH function checks to makesure that any Page Lock is released. If not, SDP_VMC_SWITCH returns anerror in an embodiment that arranges the VMC Switch Manager 4230 tore-utilize (remap) VMC VAS for targeted VMC activations. When a PageLock is being held by another VMC[m], a hole or unusable page spaceexists in the reusable address space in which at least one PG_SLOT isstill mapped for a different VMC-VAS.

In FIG. 27, one or more of the above Functions, such asSDP_VMC_UPDATE_PG_STATUS, is suitably used in another embodiment as apage-locking service for passing asynchronous messages (e.g., in secureinterrupt handling) to a particular PA or for any similar purpose. Thisexample shows interrupts coordinated with and by Strategic Resolver 4210of FIG. 17 and suitably provides operational details of block 5690 ofFIG. 25.

Operations commence with a call 5805 to secure interrupt handling. Apage-locking process is used to establish Page Lock(s) either foranother VMC[m] that is not the currently-active VMC[i] or for thecurrently-active VMC[i] itself. For example, the other VMC[m] may needto receive an asynchronous message wherein message data is copied into amessage buffer established in the VMC[m] VAS.

A step 5810 freezes the code execution state of the currently-activeVMC[i] during the period of active Page Lock(s) for the other VMC[m]. Inother words, if a message is needed for the other VMC[m] that is not thecurrently active VMC[i], that copying function is permitted. Codeexecuting the current VMC[i] is frozen and prevented in step 5810, untilthe PG-LOCKs are later released/removed/lifted in a step 5865.

For operations of the Function(s), an argument VMC_HANDLE has abit-field STATUS coded 01: Page Lock, and 10: Page Unlock. Anotherargument PG_SLOT_INDEX is a parameter indicating the actual PG_SLOTassociated with the page PHYS_SEC_PG to be locked. The parameterPG_SLOT_INDEX is specified as noted hereinabove.

In FIG. 27, after step 5810, operations proceed to a step 5815 tocommence servicing the secure interrupt. A decision step 5820 determineswhether an asynchronous message is directed to the current VMC[i] bycomparing the index i of the current VMC[i] with parameter VMC_PGLOCK inVMC_HANDLE of TABLE 10. If VMC_PGLOCK is the same as the index i of thecurrent VMC[i], then operations proceed to steps 5830-5838 to receivethe asynchronous message into the current VMC[i] and code execution ofthe current VMC[i] is unfrozen at a step 5865. If the Page Lock pertainsto a PG_SLOT in another VMC[m], meaning that VMC_PGLOCK=m and is notequal to the current VMC[i] index i in step 5820, then operations branchto a step 5840.

If VMC_PGLOCK is the same as the index i of the current VMC[i], thenoperations proceed to a step 5830. Step 5830 checks table VMC_PA2VA ofFIG. 11 (see also PA2VA 2120 of FIG. 4 and SE Page Tables 2850 of FIGS.9A-9D) to determine whether or not table VMC_PA2VA has virtual pagePG_SLOT_INDEX in the current VMC[i] assigned to a physical pagePHYS_SEC_PG.

If No In step 5830, (virtual page PG_SLOT_INDEX in the current VMC[i] isnot assigned to a physical page PHYS_SEC_PG in Secure RAM), then a step5832 calls Scavenger 4220 of FIGS. 17 and 18 to identify a particularphysical page PHYS_SEC_PG as the lock target. The PHYS_SEC_PG isprepared for its intended use, such as 1a) messaging by Swapping In thevirtual page identified by PG_SLOT_INDEX to that PHYS_SEC_PG or 1b)simply clearing the page to provide a clear data destination page bysetting to all-zeroes according to a Page Clear mode. Step 1a) suitablyinvolves Swapping In a message destination data page, and/or Swapping Ina code page from the second VMC to handle the incoming message. Then astep 5834 further prepares by 2) mapping the virtual address ofPG_SLOT_INDEX to the address of lock target PHYS_SEC_PG by writing (FIG.19) to PA2VA and/or PG_SLOT_FLAGS of FIG. 11. In some embodiments, afurther operation 3) identifies the different VMC of the locked page orassigns the locked page to the different VMC by writing to the VMCcolumn of PA2VA 2120 of FIG. 4. After step 5834, operations go to a step5836.

If Yes in step 5830 (virtual page PG_SLOT of the current VMC[i] isalready present at the appropriate PHYS_SEQ_PG), operations branch tostep 5836. Yes from step 5830 bypasses the step 5832 call to Scavenger4220 and the step 5834.

After either step 5834 or Yes in step 5830, step 5836 marks thePHYS_SEC_PG as Locked, the STATUS bit(s) for the page are set to 01(Locked according TABLE 9) in PA2VA and the PHYS_SEC_PG is now madeIneligible and prevented from being wiped by the Scavenger 4220 for thetime being. No further PG faults occur for a Locked page because thepage is being held as always-present in the VMC[i] VAS.

Then operations proceed to a step 5838 to receive the asynchronousmessage, if any, followed by step 5865 to lift the code freeze.

In step 5820, as noted hereinabove, if the Page Lock pertains to aPG_SLOT in another VMC[m], meaning that VMC_PGLOCK=m and is not equal tothe current VMC[i] index i, then operations branch to a step 5840.

Step 5840 checks table VMC_PA2VA of FIG. 11 (see also PA2VA 2120 of FIG.4 and SE Page Tables 2850 of FIGS. 9A-9D). If a Condition is true thattable VMC_PA2VA has a virtual page in the current VMC[i] assigned to aphysical page PHYS_SEC_PG, and that virtual page has the same virtualaddress offset bits specifying an offset for current VMC[i] as thevirtual offset bits PG_SLOT_INDEX that specify the offset for page to beLocked for use with the other VMC[m], then this physical pagePHYS_SEC_PG should be flushed specifically. In other words, to avoidconfusion of virtual pages in different VMCs that might otherwise pointto the same physical page in Secure RAM, the physical page is flushed.If the foregoing Condition is not true, then the Secure RAM shouldsimply be scavenged to identify a physical page in. Secure RAM to usefor the virtual page from the other VMC[m].

Accordingly, step 5840 sets a VMC_OTHER_PGLOCK bit. Step 5840 alsochecks to see whether the foregoing Condition is true and if so aPG_FLUSH_START bit is set and Scavenger 4220 is called. If the foregoingCondition is not true, the PG_FLUSH_START bit is not set, and Scavenger4220 is called. Scavenger 4220 operates as described in FIG. 18 with thefurther aspect that step 4320 checks whether PG_FLUSH_START is set andif a page flush is needed (Yes), then operations branch from step 4320,bypass the Page Wiping Advisor and wipe the physical page PHYS_SEC_PGthat satisfied the hereinabove Condition, and then go to step 4370 andproceed to Swap Out the page in step 4380 if need be. In this way, theSecure RAM page PHYS_SEC_PG occupying the PG_SLOT has its contentsflushed to the corresponding DRAM Swap page of current VMC[i] in SDRAMPG space of area 3200A of FIG. 12.

If PG_FLUSH_START is not set, then step 4320 goes to step 4330 and the et of the subsequent Scavenger 4220 operates as described earlierhereinabove in connection with FIG. 18 to find space for the new page.

Then a step 5845 calls the Swap In function of FIG. 20 to Swap In thePG_SLOT identified by VMC_HANDLE parameter VMC_PGLOCK identifying otherVMC[m] and by Parameter PG_SLOT_INDEX identifying the actual PG_SLOT byits offset from the base address of that other VMC[m]. This PG_SLOT islocked by setting the STATUS hits for it in VMC_PA2VA to “01” (Lock thePage code from TABLE 9). Notice that the step 5845 operates onpage-specific locking data established in the secure memory space andalters the page-specific locking data in-place by locking, free ofrearrangement of the locking data. Step 5845 represents the execution ofSwap In step 4390 of FIG. 18 with Return from that step 4390 to FIG. 27step 5850 in response to the active state of the VMC_OTHER_PGLOCK bitrather than doing a Return to some other part of Strategic Resolver 4210of FIG. 17 and FIG. 25. VMC_OTHER_PGLOCK bit is reset.

A step 5850 receives the asynchronous message, which is the subject ofthe secure interrupt, as applicable. When reception of the asynchronousmessage is completed, a step 5855 uses the Swap Out function of FIG. 21to Swap Out the PG_SLOT to the other VMC[m] identified by VMC_HANDLE andParameter PG_SLOT_INDEX. This PG_SLOT is unlocked using theSDP_VMC_UPDATE_PG_STATUS function.

Next, if the Condition of step 5840 is true, a step 5860 calls the SwapIn function of FIG. 20 to reconstitute the conditions just prior to step5840. The hereinabove-described Function SDP_VMC_PageLockRelease issuitably used for the purpose. If the Condition is not true, then theLocked PG_SLOT is Unlocked and wiped.

In an example of further detail, step 5855 resets a VMC_OTHER_PGLOCKbit, sets a VMC_OTHER_PGRELEASE bit, and updates VMC_PGLOCK to identifythe current VMC[i] (not the other VMC[m] at this point). PG_FLUSH_STARTremains set or is affirmatively set. Scavenger 4220 is called. Scavenger4220 step 4320 recognizes that PG_FLUSH_START is set and branches fromstep 4320, bypasses the Page Wiping Advisor and executes step 4365instead and wipes the physical page PHYS_SEC_PG that satisfied thehereinabove Condition, and then goes to step 4370 and proceeds to SwapOut the page in step 4380 if need be. In this way, the Secure RAM pagePHYS_SEC_PG occupying the PG_SLOT has its contents flushed to thecorresponding DRAM Swap page of other VMC[m] in SDRAM_PG space of area3200A of FIG. 12.

Then step 5860, in an example of further detail, calls the Swap Infunction of FIG. 20 to Swap In the PG_SLOT identified by VMC_HANDLEparameter VMC_PGLOCK identifying current VMC[i] and by ParameterPG_SLOT_INDEX identifying the actual PG_SLOT by its offset from the baseaddress of VMC[i]. The Swapped In page goes to the same PHYS_SEC_RAMpage identified by the current VMC[i] and the same PG_SLOT_INDEX. ThisPG_SLOT is unlocked by setting the STATUS bits for it in VMC_PA2VA to“10” (Unlock the Page code from TABLE 9). Step 5860 represents theexecution of Swap In step 4390 of FIG. 18 with Return from that step4390 to FIG. 27 step 5860 in response to the active state of theVMC_OTHER_PGRELEASE bit rather than doing a Return to some other part ofStrategic Resolver 4210 of FIG. 17 and FIG. 25. VMC_OTHER_PGRELEASE bitis reset.

A succeeding step 5865 then lifts the code freeze of step 5810.Operations from step 5838 also go to step 5865 to lift the code freeze.A RETURN 5895 is reached after step 5865 so that code from the currentVMC resumes executing.

For conciseness of illustration, FIG. 27 depicts some operationstogether that in some embodiments, or some phases of operation of a sameembodiment, can occur at different times. For example, themessage-destination PA sets up the message-destination page atPG_SLOT_INDEX mapped to PHYS_SEC_PG according to a procedure as shown bypart of FIG. 27 and prior to interrupt by a message source.

In a first category of embodiments such as for multi-threading, WMC[i]is the currently-operating VMC and Secure RAM is administered so thatone VMC[i] uses most of the physical pages of Secure RAM and a pageLocked for use by any other VMC[m] is the exception under the SDPembodiment. In this situation FIG. 27 depicts real-time response to theinterrupt by setting up the message-passing page for VMC[m] temporarily,receiving the asynchronous message, and closing the message-passing pageand reconstituting the original page in VMC[i]. This avoids confusion ofdifferent pages having the same virtual address offset bits pertainingto different VMS Cs. An alternative embodiment defers the reconstituteprocess of step 5860 until the current VMC[i] attempts to access theLocked page. Steps 5830-5838 of FIG. 27 also show how to establish amessage-passing page in the current VMC[i] while VMC[i] is running.

In a second category of embodiments such as for single-threading, themessage-destination page is set up by a PA of a currently-operatingVMC[m], and then later the context is switched to VMC[i]. Suppose thatthereafter the message-passing interrupt occurs, so that now thecurrently-operative VMC is VMC[i] but the locked page still correctlypertains to VMC[m]. The locked page is established and ready for useimmediately upon interrupt. The locked page has its ACT register bit setto zero to put it outside the Scavenger 4220 process. Using a PA inVMC[m] may be inapplicable to set up the destination page for itself inthe context VMC[i] precisely because VMC[i] is running. Accordingly,that earlier setup procedure by the message-destination PA suitablyinvolves steps 5830-5836 when the message-destination PA is theoperative VMC[m]. The Lock status on a PHYS_SEC_PG used for VMC[m]persists through the context switch to VMC[i]. When an interrupt by themessage source occurs at some later time, then the response is shown insteps 5805, 5810, 5815, and 5850. Pages having the same virtual addressoffset bits but respectively pertaining to different VMCs are madeindependently accessible by using PA2VA, ACT, STATUS, and the VMCidentifiers taught herein, thereby preventing confusion between suchpages. The Lock status on the message page persists and remains untilsome later time when it is released by reset or execution of theSDD_VMC_PageLockRelease function relative to that page. If theVMC_PGLOCK message-destination VMC is not equal to index i of thecurrent VMC[i], then step 5860 is suitably bypassed.

As described hereinabove for FIG. 27, SDP 4200 is coordinated withinterrupt handling, exception handling, and pre-emptive scheduling. Aform of multi-threading is supported by the context switching processesof FIG. 26, and page locking processes of FIG. 27. Other forms ofmulti-threading are also supported in other embodiments, such as byproviding plural data structures of FIG. 11 in separate areas of SecureRAM to support plural VMCs concurrently and execute them on amulti-threaded, multi-pipelined and/or multi-core processor.

In FIG. 28, an SDP system has DRAM 6110, Load Manager (or StrategicResolver) 6120, Decryption, Hashing and Checking 6130, Secure RAMphysical page pool 6140, and Secure Virtual Memory SVM/PA2VA with PageTable columns 6150 and 6170. DRAM 6110 has PA Certificate and Code 6112,PA Data 6114, and Swap File for SDP 6116 including many 4K pages. TheDRAM 6110 holds a PA image with a large sub-application, for example.The PA Certificate and PA Code 6112 are fully loaded. PA Data 6114 isstored in DRAM at this time. DRAM Swap File 6116 is ready for securedemand paging operations.

In FIG. 28, the PA Certificate and Code 6112 are copied physically to aPhysical Page Pool in Secure RAM 6140 and virtually to Secure VirtualMemory SVM by operation of the Load Manager 6120. Similarly, the PA Data6114 are copied physically to Secure RAM 6140 and virtually to SVM. TheLoad Manager 6120 is copying data, with Page Fault on write. LoadManager copies the PA Data 6114 to different pages in SVM than the pagesoccupied by the PA Certificate and Code 6112.

If the code is not self-modifying, as illustrated, the arrow from block6112 is one way (Swap In) from DRAM 6110 to Secure RAM 6140. If the codeis self-modifying then the arrows are bi-directional or two-way. Ineither case, Swap File 6116 is generally coupled to Secure RAM 6140bi-directionally (Swap In, Swap Out) by a bi-directional arrow 6118.

SDP mediates this process transparently to Secure Kernel. SDP detectswhen Secure RAM 6140 is out of free pages, triggers scavenging of SecureRAM 6140, and then copies Code and Certificate Page Headers, and Pagesthemselves, physically to Secure RAM 6140 and virtually to SVM 6150,6170.

Physically, the PA Certificate and Code 6112 are copied to Secure RAM,and virtually organized in SVM (Secure Virtual Memory) according to themapping defined by the S.E. Page Tables of FIGS. 9A-9E (also called aphysical address to virtual address table PA2VA). Notice that PA2VAcells are or may be partially filled with entries when the Secure RAM isbeing filled. The Secure RAM is smaller in page size than the DRAM.

In FIG. 28, another embodiment keeps a record of more states associatedwith SVM (secure virtual memory using Secure RAM and associatedinformation of FIG. 11). The record in block 6150 includes informationsuch as 1) Page Swapped In, 2) Page Empty, 3) Page Swapped Out, 4) PageSwapped In after Page Swapped Out. The information 1), 2), 3), 4)represents Page status information and signifies completion of key stepsin and for use by the operations of Scavenger 4220, Swapper Manager 4240and SDP External Storage Manager 4250 of FIGS. 17, 18 and 19. Block 6150is maintained as information in PA2VA or VA2PA or both.

Statistics of number of swaps associated with a page are also kept in aregister space (e.g., registers designated STAT2[N]) in some embodimentsto dynamically detect page thrashing (high number of swaps) and lowerthe priority of the page for Swap Out purposes. In one embodimentsoftware responds to number of swaps on a page exceeding a threshold toleft-shift the singleton one in a multi-bit priority code specific tothe thrashing page itself in Priority Sorting Page 3160 of FIG. 13 ofincorporated US patent application TI-39617, Ser. No. ______. In anotherembodiment software responds to a number of swaps exceeding a thresholdfor a given page, to reallocate an additional page of space in SecureRAM to the page Type (Code or Data) of the page that is experiencing theexcessive number of swaps.

In FIG. 28, SVM column 6170 (compare to PG_SLOT_FLAGS of FIG. 11)includes rows corresponding to virtual addresses A-K with Secure RAMaddresses (e.g. 4 bits for physical pages 0-15) entered in some of therows depending on which virtual addresses have physical pages in SecureRAM corresponding to them.

As noted hereinabove, SVM column 6150 for each virtual address has a rowentry comprised of plural bits representing 1) Page Swapped In, 2) PageEmpty, 3) Page Swapped Out, 4) Page Swapped In after Page Swapped Out.

For instance, any of virtual addresses H-K can have entries like 6152representing Page Empty. In case of Page Empty, no Secure RAM physicalpage assignment (represented by a diagrammatic arrow) connects PageEmpty 6152 in SVM column 6150 to any virtual address in SVM column 6170.

In FIG. 28, Read faults are suitably processed in SDP, with or without aWrite fault capability. Read fault capability involves paging in pagesof information from memory. For example, a page to overwrite in theSecure RAM is selected, and then the Read Fault is processed to page ina page from DRAM and overwriting the selected physical page in SecureRAM with the page from DRAM. For example, when the CODE_DATA field ofTABLE 4 is set for Code paging only in SDP_CFG 3130 of FIG. 11, thenRead Faults are processed without a Write fault capability. When thatCODE_DATA field is set for Data paging or both Code and Data paging,then the Write fault capability is included.

Write fault involves Swapping out pages of information to memory. Inembodiments with Write fault operation, the Write fault capability issuitably configured to be enable/disabled, such as according toCODE_DATA field of TABLE 4 or a more complicated field that includes atleast one additional bit to selectively provide a Write fault pagingmode in Scavenger 4220 of FIG. 18. In the selective Write fault pagingmode, if the Write fault is the first fault for that page, the processoris programmed (if the additional bit is active) to set the physical pagein Secure RAM to all zeros inside the secure environment first, beforeallowing the application to write to that page on the instructionrestart. The selective Write fault paging mode is suitablydefault-established by the FIG. 11 SDP_CFG 3130 CODE_DATA fieldaugmented with the additional mode bit, and then the same augmentedfield is made VMC-specific as a field in VMC_CFG_ITEM spare area ofSDP_VMC_CFG 3150.

Another example of Write fault operation selects a particular physicalpage in the Secure RAM. The Write Fault is processed to page out theinformation on the selected physical page from Secure RAM to DRAM. Thena page is loaded or swapped in from DRAM (the page of information towhich the write is intended or directed) into the selected physical pagein Secure RAM. Then the write instruction is executed by writing to thenewly-swapped in page of information residing at the selected physicalpage in the Secure RAM. A form of this Write fault operation is providedin FIG. 27 steps 5840-5845 and steps 5855-5860.

For the system of FIG. 28, the SDP abort handler (or front end faulthandler) 4260 of FIG. 17 is, for example, structured and operated todetect at least two cases. The SDP abort handler 4260 in the first casedetects a read operation producing a Read fault and then StrategicResolver 4210 and Scavenger 4220 execute Read fault handling. In thesecond case, the SDP abort handler detects a write operation, determinesa fault was from the write and not a read, and then Strategic Resolver4210 and Scavenger 4220 execute Write fault handling.

Further in FIG. 28, virtual addresses D-G all have entries like 6154representing Page Swapped In. These entries have been made in column6150 in response to respective occurrences 6174 of Data page fault onwrite. For instance, a diagrammatic one-way arrow connects Page SwappedIn 6154 in SVM column 6150 to virtual address F is SVM column 6170.

Virtual addresses B and C each have entries like 6156 representing PageSwapped Out. These entries have been made in column 6150 in response torespective occurrences 6176 of Code page fault on write. For instance, adiagrammatic one-way arrow connects Page Swapped Out 6156 in SVM column6150 to virtual address C in SVM column 6170.

Virtual address A has an entry Page Swapped In After Page Swapped Out.For purposes of example, this entry has resulted after a Page SwappedOut followed by a Page Swapped In to the same virtual address A in SVM.This entry has been made in column 6150 in response to an occurrence6178 of page fault on read.

For instance, a diagrammatic two-way arrow connects Page Swapped In 6158in SVM column 6150 to virtual address A in SVM column 6170. The PA isreading data, with Page Fault on Read. Suppose Secure RAM page pool 6140is full. A Read triggers a page fault. Scavenging frees or wipes andSwaps Out a page of Secure RAM. Operations under control of the SDPManager now check PA Header and Hashes by calculating and comparing thehash relative to pages in Secure Virtual Memory. Hashing is described inconnection with BK and BBK of FIGS. 11-13 and step 4860 of FIG. 20, step4940 of FIG. 21, and step 5470 of FIG. 24 for instance. In this way, thePA Code and PA Data are authenticated and decrypted (at least in case ofPA Data) and made available for actual execution out of the Secure RAM.

Turning to FIG. 29, a paging mechanism is provided that simultaneouslyutilizes DMA, hashing, and encryption, all in one RISC processorprogramming operation. In other words, the encryption accelerator andhashing accelerator are slaved together, and the DMA drives a page onetime from DRAM or Secure RAM through both hash and encrypt at the sametime, or hash and decrypt depending on direction in/out Secure RAM. Forinstance, logical DMA channels are utilized in concurrent operation ofthe hash and crypt operations that comprise a page swap operation. Alogical channel is suitably utilized for the hash operation, and twochannels are suitably utilized for the supply and retrieval transfersinvolved with the cryptographic operation. The high performance securedemand paging capability thereby does not involve the RISC processorexpending extra cycles on control and other operations.

In FIG. 29, an embodiment performs encryption and HMAC hashing in SDPwith symmetric keys. A system DMA 6220 includes a DMA Control circuit6222, FIFO 6224 and Internal DMA Registers 6228. A RISC. Processor 6230is coupled to System DMA 6220 and Secure RAM 6240 via a bus 6245. TheRISC Processor 6230 also supplies configuration data and other datapertinent to the System DMA 6220 to DMA Internal Registers 6228.

A Hash unit 6250 is also coupled to and fed by the DMA FIFO 6224. A RISCInterrupt Request (IRQ) Handler block 6260 responds to operations ofHash unit 6250 so that Hash results from one or more Result register(s)6262 are fed by Hash unit 6250 to RISC Processor 6230. Hash unit 6250and a cryptographic unit 6270 provide acceleration for hash andcryptographic functions respectively.

In FIG. 29, cryptographic unit 6270 is also coupled to the DMA FIFO 6224either in parallel with the Hash unit 6250 or suitably coupled elsewhereinto the DMA FIFO 6224 to accomplish operations coordinated with theoperations of Hash unit 6250. The cryptographic unit 6270 includesEncrypt and Decrypt functions either separately as shown or controllablyintegrated together. Cryptographic unit 6270 is coupled via a bus 6275to a DRAM 6280.

The RISC Processor 6230 and a MMU (Memory Management Unit) 6265 are alsocoupled to the bus 6275. DRAM 6280, Flash memory 6282 and bus 6275 arein a Non-Secure environment 6285. Parts of FIG. 29 left of bus 6275 areprotected by an SSM (Secure State Machine hardware) 6290 that monitorsand protects busses and circuit operations to establish a SecureEnvironment 6295. In effect, some secure demand paging embodimentsherein build hardware wrappers for an encryption structure and processto deliver high performance secure demand paging.

In FIG. 29, keys 6255 are stored, including Key Encryption Key, ChipIdentification (Chip ID), Platform. ID, and Code CRC (Code CyclicRedundancy Checksum). Any one, or more, or all of the keys are coupledin encrypted or unencrypted form to the Hash unit 6250 and to thecryptographic unit 6270.

Page creation (FIG. 24), descriptor blocks (FIG. 14), and tuplemaintenance (FIGS. 11-12) all contribute to higher security. Someembodiments perform encryption and HMAC hashing in SDP with symmetrickeys and other embodiments use assymetric keys. Another embodimentalternative uses HMAC in place of the separate AES encryption and SHAHash.

A process embodiment example performs encryption and HMAC hashing inSDP. In FIG. 29, a Hash accelerator 6250 runs in parallel withencryption accelerator 6270 in this HMAC process. On the front end ofHMAC a key (e.g., a Key Encryption Key or KEK) to the hash process isfed in from block 6255 to make the hashing generate a Chip-Unique hashresult. This prevents a hacker from being able to compute a hash andspoof the processor to take in a data block. The unique chip ID is usedin any suitable way. For instance, the unique chip ID in a firstalternative is combined (hashed in) with platform identification code,software code CRC (cyclic redundancy checksum), other specialized data,or any one, some or all of the foregoing. For example, the embodimentfirst runs a cycle on the hash engine 6250 (e.g., SHA1) with an HMACkey. Then the process starts both the hash engine 6250 and thecryptographic engine 6270 in parallel on the data and runs tocompletion.

In an example lacking HMAC, a process has steps of 1) Encrypt code. 2)Encrypt hash. 3) Again encrypt the hash. This process uses DMAefficiently and provides high performance by running the hashaccelerator 6250 in parallel with an encryption accelerator 6270 in thisno-HMAC approach. One initial hash iteration cycle is executed on theRISC processor 6230. Then dual crypt and hash are respectively executedin parallel on the encryption accelerator 6270 and hash accelerator 6250immediately upon completion of that initial hash iteration cycle.

In some embodiments, a three-way DMA capability is provided by SystemDMA 6220 to obtain the performance benefit of overlapping and/orsimultaneous operation of SHA I Hashing by unit 6250 and AES encryptionby unit 6270. In other embodiments, less DMA capability is providedand/or in which data is serialized on busses, the hashing and encryptionoperations are serialized instead.

In FIG. 29, the DMA 6220 itself drives hash accelerator 6250 andencryption accelerator 6270 in parallel. An extra cycle operation on thefront of the process with the SHA1 hash and hashing key occurs beforestarting the data in parallel to complete the full operation. On thetail end of the process, an additional operation encrypts the hash andadds it to a tail end of the block going out to DRAM.

On the reverse process involving decryption, the decrypt operation ofaccelerator 6270 is run through the whole encrypted block that hasearlier been stored out to DRAM. The Hash accelerator 6250 is fed withthe incoming decryption result and programmed to run down to the end ofthe block but not including the tail end hash earlier stored at the tailend of the encrypted block if that was not hashed into itself. DMA isthus used efficiently by doing a hash and encrypted hash.

In FIG. 29, DMA logical channels (e.g., 32 in number) performscatter/gather operations. The number is appropriately established forthe computer processing such as bulk encryption with HWA (hardwareaccelerators). The DMA 6220 achieves an efficient parameter shuttlingservice.

The circuit of FIG. 29 allows an unlimited number of uniquely addressedDMA operations to occur, theoretically increasing the maximum size bulkoperation to an amount limited only by size of memory even inembodiments that have a multimedia framework (MMF) that allocateschannels.

As illustrated in FIG. 5, FIG. 6, FIG. 7, and FIG. 8, for instance, someembodiments chain cryptographic and hash operations and/or blocks. SDP4200 encrypts the pages and for integrity, provide a chained HMAC or achained hash operation on the encrypted data to make a very efficientverification process.

In FIG. 29, parallel hardware accelerator operation of encryption andhash combined with a single fetch of the source data provides for notonly a very fast but also a very efficient page swap subsystem thatachieve a high bandwidth swap capability. Faster swap capability confersa proportionally large amount of virtual secure memory that can beprovided to secure applications. Because C-language applications, forinstance, may scatter data in a manner that does necessarily go to aneatly-defined page size, some embodiments encrypt all pages swapped outto DRAM for safety margin.

An example of a scatter/gather embodiment has DMA. Control Block Fetchwith the DMA functionality allowing for a maximum number of logicalchannels and having Logical Channel Registers (LCRs). Each of thesechannels permits a link to another channel, which provides ascatter/gather capability that is feasible even if it may limit thetotal number of uniquely addressed operations to the maximum number oflogical channels. An extended scatter/gather embodiment provides for anextension to the logical channel which fetches address descriptor blocksfrom any secure memory. In this way, broadly addressed scatter/gatheroperations are unlimited even in embodiment systems that share the DMAresource system-wide.

For virtual scatter/gather capability, each virtual to physical lookupis suitably performed before the start of a DMA operation while callingprocess is still in context so that virtual to physical lookups aresimplified. These lookups result in a physical page list (called anaddress descriptor or physical descriptor) being created that issuitably utilized later by a DMA secure interrupt handler at each pagecompletion to start the next physical page transfer. This speeds SDPruntime initialization of FIG. 24 and VMC activation of FIG. 26 and FIG.24.

The DMA programs itself from control blocks pre-formatted into DRAM whenthe DMA allows linking of logical channels. Even where fullscatter/gather is not part of the DMA design, this programming usagemethod regains RISC processor CPU cycles otherwise spent babysittingsmaller DMA operations. In this way, the DMA is utilized in a moreintelligent I/O controller fashion. A radio receive process suitably hasa circular ring of buffers that are consistently and continually filledby DMA without RISC processor intervention on each packet. That leavesthe RISC processor free to simply process the data contained in thosepackets, or shut a DMA-based receive operation off when the buffersapproach the full or all-buffers-used mark.

In an extended scatter/gather example herein, address descriptor blocks(ADBs) are used. These are related to the address descriptor physicalpage list of the previous paragraph herein. The ADBs are linked inmemory by a 32 bit link field in each ADB to next ADB, allowing for anunlimited number of uniquely addressed DMA transfers to memory. The ADBalso contains a control hit field with a first control bit indicatinglast ADB block (stop bit ST), and a second control bit (EI) indicatingwhether this ADB should Enable any Interrupt described in the logicalchannel registers (LCRs) upon completion or not.

The ADB fetch enhancement is suitably applied to secure memory typetargets, and to processor interrupt generation by synchronized devicetype targets. Where two logical channels are used for a DMA transfer,one logical channel using the ADB extension works with another logicalchannel which is not using ADB fetch by using that logical channel torepeat operations for each ADB fetched by its mating logical channel.This process accommodates transfers from ADB described memory locations,such as in Secure RAM of FIG. 29, to a synchronized device such s acryptographic accelerator.

FIG. 29 illustrates transfer from a single secure memory 6240 on bus totwo separate synchronous targets, and uses parallel encryption and hash.This embodiment simultaneously transfers the same secure memory data totwo synchronous targets. For cryptographic and security purposes, thesame data block is transferred to the hashing accelerator 6250 and theencryption accelerator 6270, in parallel operation, to obtain bothciphering and hash of the data. More specifically, each byte of dataentering the DMA FIFO is transferred both to the encryption accelerator6270 and the hashing accelerator 6250. The hashing accelerator 6250delivers a hash result 6262 which is read directly by the RISC processorin FIG. 29. This direct read from Hash accelerator 6250 to RISCprocessor 6230 efficiently uses the system by because such embodimentdoes not need to occupy the DMA unit 6220 with transfer of therelatively-small amount of resulting hash data that is output at the endof a Hash operation.

Decipher operation with a decryption accelerator and a hashingaccelerator feeds the output/result of a decryption block of unit 6270to the input of hashing accelerator 6250 and to Secure RAM 6240concurrently on the result side of the operation. In this example,deciphering as compared to enciphering reverses the source/target rolesof the Secure RAM and the crypt accelerator 6270, but the target role ofthe hash accelerator 6250 remains the same. For DMA transactionsinvolving encryption and hashing desired for security, each DMA transferhas a first predetermined maximum number of (e.g. one) data supplier(source) and a second predetermined maximum (e.g. two) of data consumers(targets). Any combination of synchronized or non-synchronized consumers(targets) is utilized as desired for this enhanced DMA operational mode.Sufficient bus bandwidth is provided to transfer information over a busif one bus is shared by plural accelerators that are being operatedsimultaneously from one or more memories 6280, 6282 or storage devicessuch as disk drive or remote storage.

Some process and device embodiments parallelize the acceleratoroperations with scavenging. In this way, the secure demand pagingoperates the processor for page scavenging of the secure memorysubstantially in parallel time-wise with at least some operation onanother page by the cryptographic accelerator. The page scavenging isselectively performed, such as by using the no-swap-in NSI andnext-page-to-swap-out NPSO features, to achieve very efficientprocessing and parallelization. The DMA circuit subsequently activatesthe cryptographic accelerator(s) to perform a cryptographic operation onanother page for swap out, while the processor is scavenging for yetanother page for swap out during the accelerator operation.

The foregoing operation is also useful for running the run-timeinitialization loop of FIG. 24 in parallel with the accelerationhardware. Further, for power saving embodiments, the processor issuitably provided with a sleep mode and is operated to swap out allmodified pages from the Secure RAM and transition to the sleep mode. Theprocessing, such as through DMA and accelerators or by the CPU directly,generates page hashes over unmodified pages and modified pages, andgenerates a BBK hash of the page hashes. Prior to the transition to thesleep mode, the BBK hash of hashes is updated.

Another method platform-efficiently gives the processor back to thenon-secure operating system (OS) during cryptographic hardwareoperational periods. A SE (secure environment) OS adaptation driver isassociated with the non-secure OS itself. A non-secure interrupt handlerposts a semaphore for a DMA interrupt completion event on thecryptographic operation started by SDP. The method further utilizes aCall from SE (secure environment) code to the non-secure OS at whichpoint the SE OS adaptation driver intercepts the Call and blocks on thesemaphore. The external non-secure function is released from itsprevious wait on the semaphore posted by the DMA completion interrupt.When that release occurs, the SE adaptation driver function simplyperforms a return. The above Call mechanism of secure ROM re-enters andthe SDP code continues directly after the point where that Callmechanism was invoked.

The above method keeps the entire platform responsive and the CPU athigh efficiency during the cryptographic operations of the SDP. Thismethod can be perfointed due to the fact that the secure DMA andinterconnect allows these accelerated cryptographic operations to be setup inside the SE, but continue to operate even when the SE is exited viathe Call mechanism as described above. The SDP code simply includes theCall, and the OS is not neglected during cryptographically acceleratedoperation.

Another embodiment of a secure demand paging system is illustrated inFIG. 29 wherein an external non-volatile flash memory 6282 has encryptedand integrity-protected code and data pages for Swap-in. The externalvolatile DRAM memory 6280 is specially used for bi-directionally swappedpages subject to modification by processing. The system uses thememories 6280 and 6282 ambidextrously. A processor combination 6230,6250, 6270 (RISC 6230 and accelerators 6250, 6270 viewed together as oneentity) is coupled to Secure RAM 6230 and external flash memory 6282 andoperates to decrypt and verify the integrity of the code pages therebyto transfer code pages to the Secure RAM 6240 directly from the flashmemory 6282 and bypass the DRAM 6280 in respect of the code pages. Theprocessor combination 6230, 6250, 6270 Swaps out and Swaps in the swappages between Secure RAM 6240 and DRAM 6280 and bypasses the flashmemory 6282 in respect of the swap pages for DRAM 6280.

Various embodiments are used with one or more microprocessors, eachmicroprocessor having a pipeline is selected from the group consistingof 1) reduced instruction set computing (RISC), 2) digital signalprocessing (DSP), 3) complex instruction set computing (CISC), 4)superscalar, 5) skewed pipelines, 6) in-order, 7) out-of-order, 8) verylong instruction word (VLIW), 9) single instruction multiple data(SIMD), 10) multiple instruction multiple data (MIMD), and 11)multiple-core using any one or more of the foregoing,

Design, Verification and Fabrication

Various embodiments of an integrated circuit and processes improved asdescribed her are manufactured according to a suitable process ofmanufacturing 6400 as illustrated in the flow of FIG. 30. The processbegins at step 6405 and a step 6410 prepares RTL (register transferlanguage) and netlist for a particular design of an integrated circuitincluding, for instance, a processor, a cryptographic accelerator, ahash accelerator; and a secure memory coupled to the processor andcoupled to transfer the same secure memory data to the cryptographicaccelerator and the hash accelerator in parallel, the hashingaccelerator having a hash result output coupled directly from thehashing accelerator to the processor. The Figures of drawing show someexamples, and the detailed description describes those examples andvarious other alternatives.

In a step 6415, the design of the page processing circuit is verified insimulation electronically on the RTL and netlist. In this way, thecontents and timing of the memory, of the processor and of theaccelerators are verified. The operations are verified pertaining to thedesired parallelism of operations of processor 6230, secure RAM 6240,DMA 6220, and accelerators 6250 and 6270 and memories 6280 and 6282 ofFIG. 30. Then a verification evaluation step 6420 determines whether theverification results are currently satisfactory. If not, operations loopback to step 6410.

If verification evaluation 6420 is satisfactory, the verified design isfabricated in a wafer fab and packaged to produce a resulting securedemand paging integrated circuit at step 6425 manufactured according tothe verified design. Then a step 6430 verifies the operations directlyon first-silicon and production samples by using scan chain methodologyon the page processing circuit to confirm that actual operation is inaccordance with the expected operation of the verified design. Anevaluation decision step 6435 determines whether the chips aresatisfactory, and if not satisfactory, the operations loop back as earlyin the process such as step 6410 as needed to get satisfactoryintegrated circuits.

Given satisfactory integrated circuits in step 6435, atelecommunications unit based on teachings herein is manufactured. Thispart of the process first prepares in a step 6440 a particular designand printed wiring board (PWB) of a telecommunication product having atelecommunications modern having a transmitter and receiver as in FIG.2, microprocessor 6230 coupled to the telecommunications modem to atleast one of said transmitter and receiver of the modem. Themicroprocessor 6230 is operable for instance for centrally controllingscavenging, and virtual machine context switching and page swappingfirst and second pages in response to a page fault. The swapping swapsout the first page from the Secure RAM 6240 to the external memory DRAM6280 with DMA 6220 operations and integrity information and encryptionprovided by accelerators 6250 and 6270 respectively. The swapping thenswaps in the second page from DRAM 6280 with decryption and integritycheck, in place of the first page, using accelerators 6250 and 6270 andDMA 6220. SDP certificate parameters are loaded in a step 6445 to Flash6282 and configure the secure demand paging. A user interface such as akeypad, microphone and speaker of FIG. 2, is coupled to themicroprocessor 6230.

The particular design of the page processing circuit is tested in a step6450 by electronic simulation and prototyped and tested in actualapplication.

The SDP certificate parameter(s), and other parameters as are suitablyembedded in the system according to the teachings herein, are adjustedfor increased SDP and system operational efficiency in step 6455, asreflected in faster initialization of SDP and particular VMCs, fasterapplication execution, decreased Swap Rate in executing the sameapplication code, lower power dissipation and other pertinent metrics.If further increased efficiency is called for in step 6455, thenadjustment of the parameter(s) is performed in a step 6460, andoperations loop back to reload the parameter(s) at step 6445 and dofurther testing. When the testing is satisfactory at step 6455,operations proceed to step 6470.

In a manufacturing step 6470, the signed SDP certificate and anyembedded configuration parameters for the SDP system are loaded into theFlash non-volatile memory 6282. The processor 6230 is provided andresponds to the non-volatile memory 6282 to configure and execute an SDPprotected application after assembly. The components are assembled on aprinted wiring board or otherwise manufactured as the form factor of thedesign is arranged to produce resulting secure demand paging (SDP)system units such as in telecommunications products according to thetested and adjusted and verified design. For example, manufacturing atelecommunications end product combines the above-mentioned wireline orwireless modem with the non-volatile memory 6282 and the processor 6230.Operations are completed at END 6475.

Aspects (See Explanatory Notes at End of this Section)

1A. The secure demand paging system claimed in claim 1 wherein saidswapper manager is further operable to swap out the first page from saidinternal memory to said external memory with integrity information andencryption prior to the swap in.

1B. The secure demand paging system claimed in claim 1 wherein saidabort handler includes an instruction prefetch abort handler and a dataabort handler.

1C. The secure demand paging system claimed in claim 1 furthercomprising a direct memory access (DMA) circuit coupling said processorand said external memory.

1 D. The secure demand paging system claimed in claim 1 furthercomprising a hardware accelerator responsive to said swapper manager andoperable to encrypt a page from internal memory for storage in saidexternal memory.

1E. The secure demand paging system claimed in claim 1 furthercomprising an encryption circuit responsive to said swapper manager anda source of keys coupled to said encryption block for encryption keyrotation.

1F. The secure demand paging system claimed in claim 1 furthercomprising a hardware accelerator responsive to said page swapper andoperable to hash the first page for the integrity information andstorage in said external memory of a hash value resulting from the hash.

1G. The secure demand paging system claimed in claim 1 furthercomprising a time stamper responsive to said page swapper and operableto time stamp the first page for storage in said external memory.

1H. The secure demand paging system claimed in claim 1 wherein saidabort handler is operable to determine whether an additional page faultis imminent before the instruction completes operation, and if so thensaid central controller responsive to have an additional page swapped into prevent the additional page fault. (This eliminates the additionaloverhead of the future page fault.)

1J. The secure demand paging system claimed in claim 1 furthercomprising a fault queue for holding fault descriptors when at least oneadditional page fault is preventable before the instruction completesoperation.

1K. The secure demand paging system claimed in claim 1 wherein saidabort handler is operable to ascertain whether an additional page faultis imminent and preventable before the instruction completes operation,and if so then said swapper manager responsive to swap in an additionalpage to both prevent the additional page fault and concurrently preventpage replacerraent of said second page by the additional page.

1L. The secure demand paging system claimed in claim 1 furthercomprising an instruction re-queuer responsive to said centralcontroller and operative after the swap in to re-queue for execution theinstruction associated with the page fault.

1M. The secure demand paging system claimed in claim 1L furthercomprising a secure kernel operable to generate a call to said centralcontroller, wherein said instruction re-queuer is coupled for a returnto the secure kernel.

1N. The secure demand paging system claimed in claim 1 for use with acaller wherein the caller operable to call a protected application, andthe secure demand paging system operates transparently to the caller.

1P. A secure demand paging method for use with a processor for executinginstructions, an internal memory for a first page in a first virtualmachine context, an external memory for a second page in a secondvirtual machine context, and a protective circuit coupled to saidprocessor and to said internal memory for maintaining the first pagesecure in said internal memory, the method comprising:

centrally controlling operations of scavenging,

virtual machine context switching and page swapping in response to apage fault,

the scavenging identifying the first page as a page to free,

the virtual machine context switching changing from the first virtualmachine context to the second virtual machine context, and

the swapping includes swapping in the second page from said externalmemory with decryption and integrity check, in place of the first page.

1PA. The secure demand paging method claimed in claim 1P wherein theswapping further includes swapping out the first page from said internalmemory to said external memory with integrity information and encryptionprior to the swapping in.

1PB. The secure demand paging method claimed in claim 1P furthercomprising separately handling an instruction prefetch abort and a dataabort to respectively initiate the centrally controlling.

1PC. The secure demand paging method claimed in claim 1P furthercomprising hardware-accelerated encrypting of the first page androtating encryption keys for the hardware-accelerated encryption.

1PD. The secure demand paging method claimed in claim 1P furthercomprising hardware-accelerated hashing of the first page for theintegrity information and storing in said external memory with theencrypted first page a hash value resulting from the hashing.

1PE. The secure demand paging method claimed in claim 1P furthercomprising time-stamping the first page for storing in said externalmemory.

1PF. The secure demand paging method claimed in claim 1P furthercomprising determining whether an additional page fault is likely beforethe instruction completes operation, and if so then said swapping in anadditional page to prevent the additional page fault.

1PG. The secure demand paging method claimed in claim 1PF furthercomprising concurrently preventing page replacement of said second pageby the additional page.

1R. A wireless communications unit comprising

a wireless antenna;

a wireless transmitter and receiver coupled to said wireless antenna;

a microprocessor coupled to at least one of said transmitter andreceiver, said microprocessor operable for centrally controllingscavenging, virtual machine context switching and page swapping inresponse to a page fault, the scavenging identifying the first page as apage to free, the virtual machine context switching changing from thefirst virtual machine context to the second virtual machine context, andthe swapping first swapping out the first page from said internal memoryto said external memory with integrity information and encryption andthen swapping in the second page from said external memory withdecryption and integrity check, in place of the first page; and

a user interface coupled to said microprocessor.

1RA. The wireless communications unit claimed in claim 1R furthercomprising an encrypted application securely demand paged by saidmicroprocessor.

1RB. The wireless communications unit claimed in claim 1R furthercomprising an encryption accelerator, a hash accelerator, and a directmemory access (DMA) circuit coupled to transfer the first page to saidencryption accelerator and said hash accelerator in parallel.

1RC. The wireless communications unit claimed in claim 1R furthercomprising a hash accelerator for a page, and said hashing acceleratordelivers a hash result which is read directly from said hashingaccelerator by said microprocessor.

1RD. The wireless communications unit claimed in claim 1R wherein saiduser interface has at least one arrangement selected from the groupconsisting of 1) mobile phone handset, 2) personal digital assistant(PDA), 3) wireless local area network (WLAN) gateway, 4) personalcomputer (PC), 5) WLAN access point, 6) set top box, 7) internetappliance, 8) entertainment device, and 9) base station.

1S. A wireless communications unit comprising

a wireless antenna;

a wireless transmitter and receiver coupled to said wireless antenna;

a DRAM (dynamic random access memory);

a microprocessor having a secure internal memory and coupled to at leastone of said transmitter and receiver, said microprocessor operable formulti-threading a secure demand paging process and a non-secure process,and operable to establish page configuration data and to secure demandpage between the secure internal memory and the DRAM in response to apage fault in the secure internal memory, and operable to applyconfidentiality processing page-specifically when the page configurationdata signifies confidentiality for the page, and to apply integrityprocessing page-specifically when the page configuration data signifiesintegrity protection for the page; and a user interface coupled to saidmicroprocessor.

1SA. The wireless communication unit claimed in claim 1S furthercomprising priority circuitry coupled to said microprocessor andoperable to determine priority for page replacement in said secureinternal memory.

1SB. The wireless communication unit claimed in claim 1SA wherein thepriority circuitry is further operable to accord data pages lesspriority relative to code pages for page replacement.

1SC. The wireless communication unit claimed in claim 1S farthercomprising an encrypted application securely demand paged by saidmicroprocessor.

1SD. The wireless communications unit claimed in claim 1S furthercomprising an encryption accelerator, a hash accelerator, and a directmemory access (DMA) circuit coupled to transfer the page to saidencryption accelerator and said hash accelerator in parallel.

1SE. The wireless communications unit claimed in claim 1S furthercomprising a hash accelerator for a page, and said hashing acceleratordelivers a hash result which is read directly from said hashingaccelerator by said microprocessor.

1SF. The wireless communications unit claimed in claim 1S wherein saiduser interface has at least one arrangement selected from the groupconsisting of 1) mobile phone handset, 2) personal digital assistant(PDA), 3) wireless local area network (WLAN) gateway, 4) personalcomputer (PC), 5) WLAN access point, 6) set top box, 7) interneappliance, 8) entertainment device, and 9) base station.

2A. The method claimed in claim 2 wherein the processor has variableloading, and the applying of the process being responsive to thevariable loading to execute the process at least in part duringotherwise-low processor loading.

2B. The method claimed in claim 2 wherein the processor has variableloading, and further comprising swapping out of at least one dirty pageat least in part during otherwise-low processor loading.

2C. The method claimed in claim 2 further comprising organizing theexternal DRAM for plural virtual machine contexts having pages and thesecure internal memory for pages from one virtual machine context.

2D. The method claimed in claim 2 further comprising selectivelyperforming page replacement for part of the secure internal memory tosupport a locked messaging area for a particular virtual machine contextand current pages in the secure internal memory for a current virtualmachine context.

2E. The method claimed in claim 2D further comprising allocating atleast a predetermined amount of space for the current virtual machinecontext.

2F. The method claimed in claim 2 further comprising monitoring pagethrashes on a page-specific basis and downgrading in priority for pagereplacement a page encountering excessive page thrashes.

2G. The method claimed in claim 2 further comprising monitoring pagethrashes and increasing physical page space in the secure memory whenpage thrashes are excessive.

2H. The method claimed in claim 2 further comprising downgrading inpriority for page replacement a page that was last swapped in comparedto other pages.

3A. The system claimed in 3 further comprising a wireless receivercoupled to said microprocessor.

3B. The system claimed in claim 3 wherein said non-volatile memoryfurther stores an encrypted digital rights management application forsecure demand paging by said microprocessor,

3C. The system claimed in claim 3 wherein at least one book keepingspace includes a page and a book keeping element.

3D. The system claimed in claim 3 wherein the coded physicalrepresentation of the secure demand paging process includes arepresentation of page swapping that has operations to establish a firstindex for a requested virtual machine context, establish a second indexfor a requested block book keeping block, and establish a third indexfor a requested book keeping space.

3E. The system claimed in claim 3 wherein the coded physicalrepresentation of the secure demand paging process includes arepresentation of updating a configuration structure in the secureinternal memory to reflect a swap in by a first index for requestedvirtual machine context, a second index for requested block book keepingblock, and a third index for requested book keeping space of the pageswap in.

3F. The system claimed in claim 3 wherein the book keeping spacesrespectively include a page hash, and the block book keeping blockincludes a block hash.

3G. The system claimed in claim 3 wherein the coded physicalrepresentation of the secure demand paging process includes arepresentation of saving page hashes and saving a block hash of a blockbook keeping block in secure internal memory.

3H. The system claimed in claim 3G wherein the coded physicalrepresentation of the secure demand paging process includes arepresentation of loading from DRAM to secure internal memory a pagehash and a block hash.

3J. The system claimed in claim 3H wherein the coded physicalrepresentation of the secure demand paging process includes arepresentation of verifying the loaded block hash with the saved blockhash in secure internal memory.

3K. The system claimed in claim 3H wherein the coded physicalrepresentation of the secure demand paging process includes arepresentation of integrity verification including generation of a hashover page hashes including the page hash loaded, by comparison with thesaved block hash of the block book keeping block.

3L. The system claimed in claim 3G wherein the coded physicalrepresentation of the secure demand paging process includes arepresentation of swapping a page out from secure internal memory andsaving a page hash in a book keeping space in DRAM for the page swappedout and updating in a block book keeping block in DRAM a block hashdependent on the page hash.

3M. The system claimed in claim 3 wherein the coded physicalrepresentation of the secure demand paging process includes arepresentation of encryption key rotation for encrypting pages.

3P. The system claimed in claim 3 wherein the coded physicalrepresentation of the secure demand paging process includes arepresentation of an operation to swap out a page by a first index forrequested virtual machine context, by a second index for requested blockbook keeping block, and by a third index for requested book keepingspace of the page swap out.

3Q. The system claimed in claim 3 wherein the coded physicalrepresentation of the secure demand paging process includes arepresentation of an operation to organize the secure internal memory tostore pages corresponding to at least some of the pages in a singlevirtual machine context organized in the SDP space in external memory.

3R. The system claimed in claim 3 wherein the coded physicalrepresentation of the secure demand paging process includes arepresentation of an operation to organize the secure internal memory tostore information pertaining to plural virtual machine contexts butstore selected pages into the secure internal memory from a singlevirtual machine context organized in the SDP space in external memory.

3S. An article comprising a storage medium and a coded physicalrepresentation established in the storage medium to represent electronicprocessor operations including operations to configure an SDP space in amemory, to organize the SDP space into virtual machine contexts, toorganize at least one of the virtual machine contexts into block bookkeeping blocks and book keeping spaces in the block book keeping blocks,and to execute a secure demand paging process on said book keepingspaces and block book keeping blocks.

3SA. The article claimed in claim 3S wherein said storage mediumincludes a flash memory.

3SB. The article claimed in claim 3S wherein said storage mediumincludes an optically-readable disc,

3SC. The article claimed in claim 3S wherein said coded physicalrepresentation includes encrypted representations of at least some ofthe operations.

3SD. The article claimed in claim 3S wherein said storage mediumincludes a web site.

3SE. The article claimed in claim 3S wherein said storage mediumincludes a computer loaded with said coded physical representation andaccessible for downloading of said coded physical representation.

3T. A secure demand paging (SDP) method for a portable apparatus with anexternal memory and a processor for executing at least one protectedapplication in a secure internal memory having a physical address space,the method comprising

configuring an SDP space in the external memory;organizing the SDP space into virtual machine contexts; andorganizing at least one of the virtual machine contexts into block bookkeeping blocks and book keeping spaces in the block book keeping blocks.

3TA. The method claimed in claim 3T wherein at least one book keepingspace includes a page and a book keeping element and the method furthercomprising page swapping by establishing a first index for a requestedvirtual machine context, a second index for a requested block bookkeeping block, and a third index for a requested book keeping space.

3TB. The method claimed in claim 3T further comprising organizing thesecure internal memory to store information pertaining to plural virtualmachine contexts but selecting one at a time of the virtual machinecontexts as a current virtual machine context and storing selected pagesfrom the external memory into the secure internal memory primarily fromthe selected current virtual machine context organized in the SDP spacein external memory.

3TC. The method claimed in claim 3T further comprising performing securedemand paging on an encrypted digital rights management application.

3TD. The method claimed in claim 3T wherein the book keeping spacesrespectively include a page and a page hash, and the block book keepingblock includes a block hash, and the method further comprising loading apage hash and block hash from external memory to secure internal memoryfor integrity verification.

3TE. The method claimed in claim 3TD wherein the integrity verificationincludes verifying the block hash of the block book keeping blockagainst a pre-stored value in secure internal memory.

3TF. The method claimed in claim 3TD wherein the integrity verificationincludes verifying the block hash of the block book keeping block with ahash of the hashes for the book keeping spaces in the block book keepingblock.

4A. The system claimed in claim 4 wherein the coded physicalrepresentation further represents operations to establish a table ofvirtual pages for code and data and stack for the protected application,and operations to establish a mapping between at least some of thevirtual pages and at least some of the physical address space of saidsecure internal memory by the table.

4B. The system claimed in claim 4 wherein the coded physicalrepresentation further has a representation of operations to establish aseparate shared space in secure internal memory for the protectedapplication to share with a second protected application.

4C. The system claimed in claim 4 further comprising a wireless receivercoupled to said microprocessor.

4D. The system claimed in claim 4 wherein the protected applicationincludes an encrypted application for secure demand paging by saidmicroprocessor,

4E. The system claimed in claim 4 wherein the data structure includes ahash for ach book keeping element, and a hash for each block bookkeeping block.

4F. The system claimed in claim 4 further comprising a chip for at leastsaid microprocessor, wherein the data structure includes a hash for eachbook keeping element, the chip having a hash memory space for the hashand coupled to said microprocessor, the hash memory space beingalways-powered for the hash to survive power down of saidmicroprocessor.

4G. The system claimed in claim 4 further comprising a chip for at leastsaid microprocessor, wherein the data structure includes a hash for eachbook keeping element, the chip having a hash memory space for the hashand coupled to said microprocessor, the hash memory space beingnon-volatile, whereby to impede playback attack.

4H. The system claimed in claim 4 wherein the data structure includes ahash for each book keeping element, and a hash for each block bookkeeping block, coordinated between both said secure internal memory andsaid DRAM.

4J. The system claimed in claim 4 wherein the coded physicalrepresentation of operations includes a representation of operations toaccess the data structure by a third index for different virtual machinecontexts.

4K. The system claimed in claim 4J wherein the coded physicalrepresentation of operations includes a representation of operations tohash each book keeping element, to hash each block book keeping block,and to hash each virtual machine context, P 4L. The system claimed inclaim 4 wherein the data structure includes page-specific integrityflags.

4M. The system claimed in claim 4 wherein the data structure includes anintegrity pattern for a physical page in secure internal memory.

4N. The system claimed in claim 4 wherein the data structure includespage specific confidentiality flags.

4P. A secure demand paging method for a processor for executing aprotected application in a secure internal memory having a physicaladdress space and for use with a DRAM coupled to the secure internalmemory, the method comprising establishing a data structure pertainingat least in part to both the secure internal memory and the DRAM, thedata structure organizing the protected application in the secureinternal memory into virtual pages by a first index for a book keepingelement in use, and a second index for a block book keeping block inuse, and demand paging between the secure internal memory and the DRAMutilizing the data structure.

4PA. The method claimed in claim 4P wherein establishing the datastructure includes hashing for each book keeping element, and hashingfor each block book keeping block,

4PB. The method claimed in claim 4P wherein establishing the datastructure includes a time stamp for each book keeping element,

4PC. The method claimed in claim 4P wherein establishing the datastructure includes a third index for a current virtual machine context.

4PD. The method claimed in claim 4P wherein the data structure includesa stack and the method includes verifying integrity of the pages andchecking the data structure for containment of the stack within apredetermined address boundary.

5A. The system claimed in claim 5 wherein the coded physicalrepresentation of operations further includes a representation ofindexing a set of block book keeping blocks pertaining to respectivesets of book keeping elements for the protected application, and hashingthe hash values for the book keeping elements for each block bookkeeping block together, and storing the hash result into a hash field ofthe respective block book keeping block.

5B. The system claimed in claim 5A wherein the coded physicalrepresentation of the operations includes at least two nested loops.

5C. The system claimed in claim 5A wherein the coded physicalrepresentation of the storing further includes a representation ofstoring the hash fields of the respective book keeping elements andblock book keeping blocks in both the secure internal memory and theexternal volatile memory,

5D. The system claimed in claim 5A wherein the coded physicalrepresentation of operations further includes a representation ofestablishing a set of virtual machine contexts, hashing the hash valuesfor the block book keeping blocks of each virtual machine contexttogether, and storing the hash result into a hash field of therespective virtual machine context.

5E. The system claimed in claim 5D wherein the coded physicalrepresentation of the storing further includes a representation ofstoring the hash fields of block book keeping blocks and the hash fieldsof virtual machine contexts in both the secure internal memory and theexternal volatile memory.

5F. The system claimed in claim 5A wherein the coded physicalrepresentation of operations further includes a representation ofselective operation with including a first alternative of initializing aset of virtual machine contexts and a second alternative of activating asingle virtual machine context to update such a set.

6A. The system claimed in claim 6 wherein the additional protectedapplication has a virtual space and the coded physical representationincludes a representation of mapping at least part of the virtual spacefor the additional protected application to the physical page space ofthe secure memory.

6B. The system claimed in claim 6 wherein the coded physicalrepresentation includes a representation of an operation to reserve insaid external volatile memory an SDP space for SDP operations in saidexternal volatile memory.

6C. The system claimed in claim 6 wherein the coded physicalrepresentation includes a representation of an SDP API (applicationperipheral interface) process coupling said operating system and saidSDP protected application.

6D. The system claimed in claim 6 wherein the SDP abort handler includesan SDP prefetch abort handler and an SDP data abort handler.

6E. The system claimed in claim 6D wherein the client application has anoperation to access a code page and an operation to access a data page,and the operation to vector includes a first operation for transfer ofan unsuccessful code page access to the SDP prefetch abort handler and asecond operation for transfer of an unsuccessful data page access to theSDP data abort handler.

6F. The system claimed in claim 6 wherein the SDP protected applicationhas a configuration for enabling or disabling write fault handling.

6G. The system claimed in claim 6 wherein the SDP protected applicationsupports multi-threading.

6H. The system claimed in claim 6 wherein the SDP protected applicationincludes a representation of an operation to establish page-specificlocking data in the secure memory space and to alter the page-specificlocking data in-place free of rearrangement of the locking data.

6K. The system claimed in claim 6 wherein said microprocessor furtherincludes a secure non-volatile memory holding an entry address to theSDP abort handler to support the operation to vector.

6L. The system claimed in claim 6 wherein the SDP protected applicationincludes a representation of an operation to swap out a modified pagefrom said secure memory.

6M. The system claimed in claim 6 wherein the SDP protected applicationincludes a representation of an operation to swap out a modified pagefrom said secure memory with a time-stamp,

6N. The system claimed in claim 6M wherein the operation to swap outincludes a representation of an operation to store a page-specific timestamp both in the secure memory space and in said external volatilememory, and the operation to load the pertinent page has an operation toload the page-specific time-stamp with the pertinent page from theexternal volatile memory to said secure memory and to compare thepage-specific time-stamp with the already-stored time stamp in thesecure memory for that page.

6P. The system claimed in claim 6 wherein the SDP protected applicationfurther includes a representation of an operation for page replacementfor the secure memory that treats a code page differently from a datapage for page replacement in the secure memory, prior to the load of thepertinent page of the protected application.

6Q. An article comprising a storage medium and a coded physicalrepresentation established in the storage medium to represent electronicprocessor operations including operations for an operating system, aclient application, a secure demand paging (SDP) protected applicationand at least one additional protected application,

said SDP protected application including an SDP abort handler and arepresentation of operations to memory-save the additional protectedapplication page-wise via decryption, authentication, encryption andintegrity protection governed by a page-specific confidentiality flagand page-specific integrity flag;said client application including a representation of an access directedto a pertinent page of the additional protected application, theoperating system including a representation of an access abort detectionand an operation to vector access abort to the SDP abort handler,said SDP protected application further including a representation of anoperation to search for the pertinent page of the protected application,a load of a pertinent page of the protected application by decryptionand authentication governed by the confidentiality flag and theintegrity flag, and re-queue of the access to the pertinent page.

6QA. The article claimed in claim 6Q wherein said storage mediumincludes a flash memory.

6QB. The article claimed in claim 6Q wherein said storage mediumincludes an optically-readable disc.

6QC. The article claimed in claim 6Q wherein said storage mediumincludes a web site.

6QD. The article claimed in claim 6Q wherein said storage mediumincludes a computer loaded with said coded physical representation andaccessible for downloading of said coded physical representation to aremote location.

7A. The system claimed in claim 7 wherein the coded physicalrepresentation farther has a representation of operations to switch fromthe first virtual machine context to another virtual machine contextwhile maintaining the page-specific lock and index of the first virtualmachine context for the page.

7B. The system claimed in claim 7 wherein the locked page is establishedand ready for interrupt messaging.

7C. The system claimed in claim 7 wherein the coded physicalrepresentation further has a representation of operations to establishpages in said external volatile memory for a plurality of virtualmachine contexts each accessible by a respective value of the index,each virtual machine context having a respective base address, the pageshaving respective virtual address offsets relative to the base addressof the virtual machine context of a page.

7D. The system claimed in claim 7C wherein the coded physicalrepresentation further has a representation of operations to associatethe page-specific lock with the virtual machine context index value, andto switch from the first virtual machine context to another virtualmachine context while maintaining the page-specific lock and index valueof the first virtual machine context for the page, whereby to avoidconfusing the locked page with a page having the same virtual addressoffset bits but pertaining to the other virtual machine context.

7E. The system claimed in claim 7 wherein the coded physicalrepresentation further has a representation of operations tosubsequently release the page-specific lock for the page.

7F. The system claimed in claim 7 wherein the coded physicalrepresentation further has a representation of operations to establish asecond virtual machine context and to establish a separate space insecure internal memory that is shared between the first-name and secondvirtual machine contexts.

7G. The system claimed in claim 7 wherein said non-volatile memoryincludes storage for an operating system and the coded physicalrepresentation further has a representation of operation to handshakewith the operating system upon establishing the secure demand pagingconfiguration in said secure internal memory.

7H. The system claimed in claim 7 wherein the coded physicalrepresentation further has a representation of operations to switch fromthe virtual machine context to another virtual machine context and tounlock a code page in said secure internal memory.

7J. The system claimed in claim 7 for use with a memory management unithaving a page table and wherein the coded physical representationfurther has a representation of operations to switch from the virtualmachine context to a new virtual machine context and to rebuild the MMUpage table with another mapping of virtual addresses to physicaladdresses for the new virtual machine context,

7K. The system claimed in claim 7 wherein the coded physicalrepresentation further has a representation of an update to the index ofthe virtual machine context to an index value for a new virtual machinecontext.

7L. The system claimed in claim 7 further comprising a secure register,wherein the coded physical representation further has a representationof operations to switch from the virtual machine context to a newvirtual machine context, the switch including update to the secureregister with page-specific data pertaining to scavenging.

7M. The system claimed in claim 7 wherein the coded physicalrepresentation further has a representation of operations to switch fromthe virtual machine context to a new virtual machine context, the switchincluding activation of the new virtual machine context in a securemode,

7N. The system claimed in claim 7 wherein the secure demand pagingconfiguration further includes page status data for page empty.

7P. The system claimed in claim 7 wherein the secure demand pagingconfiguration further includes page status data pertaining to pageswapping,

7Q. The system claimed in claim 7 wherein the secure demand pagingconfiguration further includes page status data including page swappedin, page swapped out, and page swapped out with page swapped in.

7R. The system claimed in claim 7 wherein the secure demand pagingconfiguration further includes page status data pertaining to pagelocking.

7S. The system claimed in claim 7 wherein the secure demand pagingconfiguration further includes a virtual address space size of thevirtual machine context.

7T. The system claimed in claim 7 wherein the virtual machine contexthas a virtual address space and the stack is situated at the bottom ofthe virtual address space of the virtual machine context.

7U. The system claimed in claim 7 wherein the stack has a high addressside and a low address side in virtual address space and thenon-volatile memory further having first and second unused page slotsrespectively situated on the high address side and low address side ofthe stack, whereby buffer overflow attack is impeded.

7V. The system claimed in claim 7 further comprising a monitoringcircuit coupled to detect expansion of the stack beyond a predeterminedaddress boundary, whereby impeding buffer overflow attack.

7W. The system claimed in claim 7 wherein the coded physicalrepresentation further has a representation of operations to switch fromthe virtual machine context to a new virtual machine context, therepresentation of operations to switch including an operation to load atleast one page and new page-specific, lock data for the new virtualmachine context from said external volatile memory to said secureinternal memory.

8A. The system claimed in claim 8 wherein the coded physicalrepresentation includes configuration information to include aparticular page type in said search or not.

8B. The system claimed in claim 8 wherein the coded physicalrepresentation includes configuration information to include aparticular page type in said request operation or not

8C. The system claimed in claim 8 wherein the coded physicalrepresentation further has a representation of an operation to determinewhether the identified physical page has a characteristic unsuitable forwiping and if so, identify another physical page to wipe,

8D. The method claimed in claim 8C wherein the characteristic includesthe identified physical page is locked.

8E. The method claimed in claim 8C wherein the characteristic includesthe identified physical page is last swapped in.

8F. The method claimed in claim 8 wherein the representation of theoperation to search includes identification of plural physical pages towipe and a selection of one of those physical pages to wipe.

8G. The method claimed in claim 8 wherein the representation of theoperation to search includes pre-selection of plural physical pages towipe and a random selection of a physical page from among the pluralpages to wipe to identify said physical page to wipe.

8H. The method claimed in claim 8 wherein the representation of theoperation to search is conditioned on a status of secure internal memoryfor paging as full,

9A. The system claimed in claim 9 wherein the coded physicalrepresentation further has a representation of operation to determinewhether a condition is true that a virtual page in the current virtualmachine context is assigned to a physical page and that virtual page hasthe same virtual address offset bits specifying an offset for currentvirtual machine context as the virtual offset bits that specify theoffset for page to be used for the message with the second virtualmachine context, and when said condition is true then to flush thisphysical page specifically and then to prepare the page for handling theasynchronous message.

9B. The system claimed in claim 9 wherein the coded physicalrepresentation further has a representation of operation to determinewhether the virtual machine context for the message is current virtualmachine context but the page is absent from said internal secure memory,and in such case to wipe a page and prepare the page for handling theasynchronous message in the current virtual machine context.

9C. The system claimed in claim 9 wherein the coded physicalrepresentation further has a representation of operation to swap out amodified page in internal secure memory occupying a predetermined pageslot for handling said asynchronous message.

9D. The system claimed in claim 9 wherein the representation ofoperation to prepare the particular page includes a swap in of code fromthe second virtual machine context from said external memory forhandling said asynchronous message.

9E. The system claimed in claim 9 wherein the representation ofoperation to prepare the particular page includes a mode for clearingthe particular page.

9F. The system claimed in claim 9 wherein the representation ofoperation to prepare the particular page includes locking the page.

9G. The system claimed in claim 9 wherein the representation ofoperation to prepare the particular page includes assigning theparticular page to the second virtual machine context.

9H. The system claimed in claim 9 wherein the coded physicalrepresentation further has a representation of operation to swap out themessage from the predetermined page slot from internal secure memory toexternal memory, and to unlock the predetermined page slot.

9J. The system claimed in claim 9 wherein the coded physicalrepresentation further has a representation of operation to swap in thepage from the first virtual machine context in external memory torestore the particular page, and to unfreeze code execution in the firstvirtual machine context.

9K. The system claimed in claim 9 wherein the coded physicalrepresentation further has a representation of operation to unfreezecode execution in the first virtual machine context and to subsequentlyswap in the particular page from the first virtual machine context inexternal memory to restore the particular page provided the currentvirtual machine context subsequently attempts to access the particularpage.

9L. The system claimed in claim 9 wherein the coded physicalrepresentation further has a representation of operation to generate asecure interrupt for the asynchronous message prior to the freeze ofcode execution.

9M. The system claimed in claim 9 wherein the coded physicalrepresentation further has a representation of operation to swap out themessage from the predetermined page slot by encryption and hashinggoverned by a page-specific confidentiality flag and a page-specificintegrity flag.

9N. The system claimed in claim 9 wherein the coded physicalrepresentation further has a representation of operation to swap in codefrom the second virtual machine context by decryption and authenticationby a page-specific confidentiality flag and a page-specific integrityflag.

9P. The system claimed in claim 9 further comprising a wireless modemcoupled to said microprocessor.

10A. The secure demand paging system claimed in claim 10 furthercomprising a memory management unit wherein said secure internal memoryhas physical addresses and said memory management unit is responsive tovirtual addresses, and said processor is further operable to establish atable in secure internal memory relating at least some of the physicaladdresses to at least some of the virtual addresses.

10B. The secure demand paging system claimed in claim 10A wherein saidprocessor is further operable to record entries in the table identifyingwhether a page slot is empty.

10C The secure demand paging system claimed in claim 10A wherein saidprocessor is further operable to record entries in the table identifyingswap status for a page slot.

10D. The secure demand paging system claimed in claim 10A wherein saidprocessor is further operable to record entries in the table identifyingwhether a page slot is swapped in, or a page is swapped out, or a pageis swapped in after a page was swapped out

10E. The secure demand paging system claimed in claim 10 wherein saidprocessor is further operable to select code and data pages differentlyin priority for swap out.

10F. The secure demand paging system claimed in claim 10 wherein saidprocessor is further operable to select pages differently in priorityfor modified or unmodified pages for page fault on read and for pagefault on write.

11A. The secure demand paging system claimed in claim 11 wherein thehash accelerator is further operable to perform a hash on identificationinformation before said transfer in parallel.

11 B. The secure demand paging system claimed in claim 11 wherein thehash accelerator is further operable to perform a key hash before saidtransfer in parallel.

11C. The secure demand paging system claimed in claim 11 wherein thecryptographic accelerator is operable to encrypt the hash result uponcompletion of the parallel transfer of the data.

11D. The secure demand paging system claimed in claim 11 furthercomprising a DMA (direct memory access) circuit operable to couple saidsecure memory to said cryptographic accelerator for encryption and tosaid hash accelerator.

11E. The secure demand paging system claimed in claim 11D wherein saidDMA circuit is coupled to activate said cryptographic accelerator andsaid hash accelerator by said DMA circuit itself.

11F. The secure demand paging system claimed in claim 11D wherein saidcryptographic accelerator and said hash accelerator are operable as twosynchronous targets for said DMA circuit.

11G. The secure demand paging system claimed in claim 11F furthercomprising an external volatile memory wherein said DMA circuit isfurther operable to couple said cryptographic accelerator to saidexternal volatile memory.

11H. The secure demand paging system claimed in claim 11 furthercomprising a DMA (direct memory access) circuit operable to couple adecryption stream from said cryptographic accelerator concurrently tosaid secure memory and to said bash accelerator.

11J. The secure demand paging system claimed in claim 11H furthercomprising an external volatile memory and wherein said DMA circuit isoperable to couple said external volatile memory to said cryptographicaccelerator for decryption.

11K. The secure demand paging system claimed in claim 11D wherein saidDMA circuit has virtual scatter/gather capability with virtual tophysical lookups prior to a DMA operation.

11L. The secure demand paging system claimed in claim 11K wherein thelookups provide a physical page list, and said DMA circuit has a secureinterrupt handler and is operable at each page completion to start thenext physical page transfer based on the physical page list.

11M. The secure demand paging system claimed in claim 11K wherein saidDMA has first and second logical channels and said DMA circuit isoperable for DMA fetch to operate the first logical channel in responseto the physical page list and operate the second logical channel torepeat each fetch by the first logical channel.

11P. The secure demand paging system claimed in claim 11D wherein saidhashing accelerator is operable to deliver the hash result directly tosaid processor to bypass said DMA circuit.

11Q. The secure demand paging system claimed in claim 11 wherein saidhash accelerator supplies an interrupt request, and said processor isresponsive to the interrupt request to read the hash result directlyfrom the hashing accelerator.

11R. The secure demand paging system claimed in claim 11 furthercomprising a security key and wherein said hash accelerator isresponsive to said security key.

11S. The secure demand paging system claimed in claim 11 furthercomprising an external volatile memory coupled to said secure memory toreceive pages from said secure memory hashed by said hash acceleratorand encrypted by said cryptographic accelerator.

11T. The secure demand paging system claimed in claim 11 furthercomprising an external memory coupled to said secure memory to feedpages from said external memory to said secure memory, the pagesdecrypted by said cryptographic accelerator and hash-checked by saidhash accelerator in parallel,

11U. The secure demand paging system claimed in claim 11 furthercomprising a source of rotating cryptographic keys coupled to saidcryptographic accelerator.

11V. The secure demand paging system claimed in claim 11 furthercomprising source of rotating cryptographic keys coupled to said hashaccelerator.

11W. A process of manufacturing a secure demand paging integratedcircuit comprising preparing a particular design of an integratedcircuit including:

a processor;

a cryptographic accelerator;

a hash accelerator; and

a secure memory coupled to said processor and coupled to transfer thesame secure memory data to the cryptographic accelerator and the hashaccelerator in parallel, the hashing accelerator having a hash resultoutput coupled directly from the hashing accelerator to said processor;

verifying the design of said secure demand paging integrated circuit insimulation; and

manufacturing to produce a resulting secure demand paging integratedcircuit according to the verified design.

13A. The device claimed in claim 13 wherein said processor is operableto selectively perform the page scavenging so that a swap out isincluded and a swap in is bypassed.

13B. The device claimed in claim 13 wherein said processor is operableto selectively perform the page scavenging so that page wiping isincluded and a swap out of a modified wiped page is deferred.

13C. The device claimed in claim 13 wherein said processor is operablein the page scavenging to find a second page for swap out,

13D. The device claimed in claim 13C wherein said processor is furtheroperable in the page scavenging to store an identification of thatsecond page.

13E. The device claimed in claim 13 wherein said processor is furtheroperable to swap in a page after the page scavenging.

13F. The device claimed in claim 13C wherein said DMA circuit isoperable to subsequently activate said cryptographic circuit to performa cryptographic operation on the second page for swap out,

13G. The device claimed in claim 13F wherein said processor is operableduring the page scavenging to find a third page for swap out during theoperation on the second page by said cryptographic circuit,

13H. The device claimed in claim 13 wherein said processor has a pagereplacement policy for said page scavenging to find a high priority pagefor swap out.

13J. The device claimed in claim 13 wherein said processor is alsooperable prior to the operation on the first page by the cryptographiccircuit to identify the first page for swap out.

13K. The device claimed in claim 13 wherein said processor is operableduring the page scavenging to identify a next page for swap out, storean identification of that next page, and said DMA circuit issubsequently responsive to the stored identification of that next pageto perform a cryptographic operation on that next page.

13L. The device claimed in claim 13 wherein said processor has a sleepmode and is operable to swap out all modified pages from said securememory and transition to the sleep mode.

13M. The device claimed in claim 13L wherein said processor is furtheroperable to hash pages including pages and modified pages, and togenerate a hash of hashes, and prior to the transition to the sleep modeto update the hash of hashes based on hashed pages and hashed modifiedpages.

14A. The device claimed in claim 14 wherein said processor is operableto selectively perform the page scavenging so that a swap out isincluded and a swap in is bypassed.

14B. The device claimed in claim 14 wherein said processor is operableto selectively perform the page scavenging so that page wiping isincluded and a swap out of a modified wiped page is deferred.

14C. The device claimed in claim 14B wherein said processor is operableto establish a queue identifying pages for which swap out is deferred,

14D. The device claimed in claim 14C wherein said processor is operableto subsequently swap out pages in response to the queue identifyingpages for which swap out is deferred.

14E. The system claimed in claim 14 wherein the page scavenger includesa priority for wiping out a page.

14F. The system claimed in claim 14E wherein the page scavenger includesa subsequent page swapping out operation.

14G. The system claimed in claim 14 wherein said page scavenger isscheduled for an interval preceded by an interval for execution of theprotected application.

14H. The system claimed in claim 14 wherein said processor is operableto perform a virtual machine context switch to load a protectedapplication, run the protected application, and execute the pagescavenger.

14J. The system claimed in claim 14 wherein said processor is operableto perform a first call to the page scavenger during a busier intervalwhen the secure internal memory is full for paging purposes, and asecond call to page scavenger during said at least one interval oflower-activity status.

14K. The system claimed in claim 14 wherein said processor is operableto perform a virtual machine context activation during an interval oflower-activity status,

14L. The system claimed in claim 14 wherein said processor is operableto perform a virtual machine context deactivation during an interval oflower-activity status,

Notes: Aspects are paragraphs which might be offered as claims in patentprosecution. The above dependently-written Aspects have leading digitsand internal dependency designations to indicate the claims or aspectsto which they pertain. Aspects having no internal dependencydesignations have leading digits and alphanumerics to indicate theposition in the ordering of claims at which they might be situated ifoffered as claims in prosecution,

It is emphasized here that while some embodiments may have an entirefeature totally absent or totally present, other embodiments have moreor less complex arrangements that execute some code portions,selectively bypass others, and have some operations running concurrentlysequentially regardless. Accordingly, words such as “enable,” disable,”“operative,” “inoperative” are to be interpreted relative to the codeand circuitry they describe. For instance, disabling (or makinginoperative) or bypassing of a first function can omit the firstfunction with no other change, or introduce or modify otherfunctionality, or decrease or increase the functionality represented bythe first function. Bypassing or modifying code increases functionalityin some embodiments and omits functionality in other embodiments.

A few preferred embodiments have been described in detail hereinabove.It is to be understood that the scope of the invention comprehendsembodiments different from those described yet within the inventivescope. Microprocessor and microcomputer are synonymous herein.Processing circuitry comprehends digital, analog and mixed signal(digital/analog) integrated circuits, ASIC circuits, PALs, PLAs,decoders, memories, non-software based processors, and other circuitry,and digital computers including microprocessors and microcomputers ofany architecture, or combinations thereof. Internal and externalcouplings and connections can be ohmic, capacitive, direct or indirectvia intervening circuits or otherwise as desirable. Implementation iscontemplated in discrete components or fully integrated circuits in anymaterials family and combinations thereof. Various embodiments of theinvention employ hardware, software or firmware. Process diagrams hereinare representative of flow diagrams for operations of any embodimentswhether of hardware, software, or firmware, and processes Of manufacturethereof.

While this invention has been described with reference to illustrativeembodiments, this description is not to be construed in a limitingsense. Various modifications and combinations of the illustrativeembodiments, as well as other embodiments of the invention may be made.The terms “including”, “includes”, “having”, “has”, “with”, or variantsthereof are used in the detailed description and/or the claims to denotenon-exhaustive inclusion in a manner similar to the term “comprising”.It is therefore contemplated that the appended claims and theirequivalents cover any such embodiments, modifications, and embodimentsas fall within the true scope of the invention.

What is claimed is: 1-12. (canceled)
 13. A secure demand paging (SDP)system comprising an external volatile memory; a microprocessor coupledto said external volatile memory, said microprocessor having a secureinternal memory having a physical address space, and said microprocessoroperable to execute at least one protected application in the secureinternal memory and to execute a client application at intervals andalso have at least one interval of lower-activity status; and anon-volatile memory storing a coded physical representation ofoperations accessible by said microprocessor including a representationof an SDP protected application including a page scavenger, and anoperation to schedule the page scavenger for said at least one intervalof lower-activity status.
 14. The device claimed in claim 13 whereinsaid processor is operable to selectively perform the page scavenging sothat a swap out is included and a swap in is bypassed.
 15. The deviceclaimed in claim 13 wherein said processor is operable to selectivelyperform the page scavenging so that page wiping is included and a swapout of a modified wiped page is deferred.
 16. The device claimed inclaim 15 wherein said processor is operable to establish a queueidentifying pages for which swap out is deferred.
 17. The device claimedin claim 16 wherein said processor is operable to subsequently swap outpages in response to the queue identifying pages for which swap out isdeferred.
 18. The system claimed in claim 13 wherein the page scavengerincludes a priority for wiping out a page.
 19. The system claimed inclaim 18 wherein the page scavenger includes a subsequent page swappingout operation.
 20. The system claimed in claim 13 wherein said pagescavenger is scheduled for an interval preceded by an interval forexecution of the protected application.
 21. The system claimed in claim13 wherein said processor is operable to perform a virtual machinecontext switch to load a protected application, run the protectedapplication, and execute the page scavenger.
 22. The system claimed inclaim 13 wherein said processor is operable to perform a first call tothe page scavenger during a busier interval when the secure internalmemory is full for paging purposes, and a second call to page scavengerduring said at least one interval of lower activity status.
 23. Thesystem claimed in claim 13 wherein said processor is operable to performa virtual machine context activation during an interval oflower-activity status.
 24. The system claimed in claim 13 wherein saidprocessor is operable to perform a virtual machine context deactivationduring an interval of lower-activity status.
 25. A process for providinga secure demand paging (SDP) system comprising: providing an externalvolatile memory; providing a microprocessor coupled to said externalvolatile memory, said microprocessor having a secure internal memoryhaving a physical address space, and said microprocessor operable toexecute at least one protected application in the secure internal memoryand to execute a client application at intervals and also have at leastone interval of lower-activity status; and providing a non-volatilememory storing a coded physical representation of operations accessibleby said microprocessor including a representation of an SDP protectedapplication including a page scavenger, and an operation to schedule thepage scavenger for said at least one interval of lower-activity status.26. The process in claim 25 wherein said processor is operable toselectively perform the page scavenging so that a swap out is includedand a swap in is bypassed.
 27. The process claimed in claim 25 whereinsaid processor is operable to selectively perform the page scavenging sothat page wiping is included and a swap out of a modified wiped page isdeferred.
 28. The process claimed in claim 27 wherein said processor isoperable to establish a queue identifying pages for which swap out isdeferred.
 29. The process claimed in claim 28 wherein said processor isoperable to subsequently swap out pages in response to the queueidentifying pages for which swap out is deferred.
 30. The processclaimed in claim 25 wherein the page scavenger includes a priority forwiping out a page.
 31. The process claimed in claim 30 wherein the pagescavenger includes a subsequent page swapping out operation.
 32. Theprocess claimed in claim 25 wherein said page scavenger is scheduled foran interval preceded by an interval for execution of the protectedapplication.
 33. The process claimed in claim 25 wherein said processoris operable to perform a virtual machine context switch to load aprotected application, run the protected application, and execute thepage scavenger.
 34. The process claimed in claim 25 wherein saidprocessor is operable to perform a first call to the page scavengerduring a busier interval when the secure internal memory is full forpaging purposes, and a second call to page scavenger during said atleast one interval of lower activity status.
 35. The process claimed inclaim 25 wherein said processor is operable to perform a virtual machinecontext activation during an interval of lower-activity status.
 36. Thesystem claimed in claim 25 wherein said processor is operable to performa virtual machine context deactivation during an interval oflower-activity status.
 37. A communications apparatus, comprising: anexternal volatile memory; a microprocessor coupled to said externalvolatile memory, said microprocessor having a secure internal memoryhaving a physical address space, and said microprocessor operable toexecute at least one protected application in the secure internal memoryand to execute a client application at intervals and also have at leastone interval of lower-activity status; a non-volatile memory storing acoded physical representation of operations accessible by saidmicroprocessor including a representation of an SDP protectedapplication including a page scavenger, and an operation to schedule thepage scavenger for said at least one interval of lower-activity status;an antenna; a transmitter and a receiver coupled to said antenna and tosaid microprocessor; and a user interface coupled to saidmicroprocessor.
 38. The communications apparatus in claim 37 whereinsaid processor is operable to selectively perform the page scavenging sothat a swap out is included and a swap in is bypassed.
 39. Thecommunications apparatus in claim 37 wherein said processor is operableto selectively perform the page scavenging so that page wiping isincluded and a swap out of a modified wiped page is deferred.
 40. Thecommunications apparatus in claim 39 wherein said processor is operableto establish a queue identifying pages for which swap out is deferred.41. The communications apparatus in claim 40 wherein said processor isoperable to subsequently swap out pages in response to the queueidentifying pages for which swap out is deferred.
 42. The communicationsapparatus in claim 37 wherein the page scavenger includes a priority forwiping out a page.
 43. The communications apparatus in claim 42 whereinthe page scavenger includes a subsequent page swapping out operation.44. The communications apparatus in claim 37 wherein said page scavengeris scheduled for an interval preceded by an interval for execution ofthe protected application.
 45. The communications apparatus in claim 37wherein said processor is operable to perform a virtual machine contextswitch to load a protected application, run the protected application,and execute the page scavenger.
 46. The communications apparatus inclaim 37 wherein said processor is operable to perform a first call tothe page scavenger during a busier interval when the secure internalmemory is full for paging purposes, and a second call to page scavengerduring said at least one interval of lower activity status.
 47. Thecommunications apparatus in claim 37 wherein said processor is operableto perform a virtual machine context activation during an interval oflower-activity status.
 48. The system claimed in claim 37 wherein saidprocessor is operable to perform a virtual machine context deactivationduring an interval of lower-activity status.